Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set analysis Help

Hi All,

I need to sum all sales for the max year and for each unique transaction number.

I was able to sum for the ma year:

     sum({<YearPeriod={$(=Max(YearPeriod))}>} [Sales])

but I need to add an additional condition of distinct transaction number so that it will sum one row per each transaction number.


The reason why I have to do this is because there are multiple rows with the same sales amount for unique transaction numbers.

Can anyone help?

3 Replies
swuehl
MVP
MVP

Sum({<YearPeriod={$(=Max(YearPeriod))}>}

     Aggr(  

           Only({<YearPeriod={$(=Max(YearPeriod))}>} [Sales])

          , TransactionID)

)

Not applicable
Author

Great! What if I wanted to include all the years?

swuehl
MVP
MVP

Sum(

     Aggr(

           Only( [Sales])

          , TransactionID)

)