Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
375 views
in Technique[技术] by (71.8m points)

qlikview - Qlik Sense Sum of One field based on unique value of other fields

Sample Data:

    P   Q    R
    1   A    3
    1   A    3
    1   A    2
    1   B    5
    1   C    7
    2   A    3
    2   A    3

Expected Output:

P   Q    R
1   A    5
1   B    5
1   C    7
2   A    3
    

i Have tried this Sum (Distinct R) but it is not working. i need to group by P and Q column and add Unique Value of R for that. Please support

question from:https://stackoverflow.com/questions/65626899/qlik-sense-sum-of-one-field-based-on-unique-value-of-other-fields

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

In chart, you have to add P and Q fields as dimensions. Then your expression should work just fine.

In script your code should look like this:

Load P, Q, Sum( Distinct R ) as sum_of_R
FROM sample_data
Group By P, Q;

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...