Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sum field B if field A is distinct

Dears,

How can I sum all the values of field B, only if field A is distinct.

In other words.

Collect all distinct values of field B, and sum its column A value.

Thanks per your attention,

Best regards,

7 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     Would you please give an example for more clarification.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

Sum({<Distinct SN>} TotalLabor)

SN the number to be distinct

TotalLabor the number to be summed!

Thanks

Not applicable
Author

Sum({<Distinct SN>} TotalLabor)

SN the number to be distinct

TotalLabor the number to be summed!

Thanks

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     Could you please explain with example.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
jagan
Luminary Alumni
Luminary Alumni

Hi,

It is not possible, you need to arrive a flag for the first value in the script , so that you can directly sum up the values.

Can you please come up with sample data and example.

Hope this helps you.

Regards,

Jagan.

Not applicable
Author

You probably already had solved this problem,however, recently I've tryied to solve that question and it was not too easy to be solved.

It could be solved with it:

sum(aggr(sum(DISTINCT B), A))

deshikas
Contributor III
Contributor III

Had the same issue your solution fixed for me.  Thanks Luiz