Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP 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)

)