Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
KAnderson_5
Contributor
Contributor

Issue using nodistinct

I'm trying to get the total sales across all product groups to do a calculation of profit contribution.  For some reason, I'm unable to have consistent returns across all product groups, which will, in turn, throw off the calculation.

The set analysis I'm using: 

Sum(Aggr(nodistinct Sum({$<Type {'Daily'},ProductGroup=,ProductSubGroup=,ProductDetailGroup=>}SalesCY),Store,DateCY))

 

Photo shows where I'm seeing inconsistencies for column 1Gross Ticket Contribution.  Those items highlighted in red are the correct value for Store #1, remaining items aren't.

Labels (1)
1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

You may not need an Aggr() here. How about this?

Sum({$<Type = {'Daily'}, ProductGroup, ProductSubGroup, ProductDetailGroup>} TOTAL <Store> SalesCY)

or

Sum({$<Type = {'Daily'}>} TOTAL <Store> SalesCY)

Add other fields to the total qualifier if needed

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

4 Replies
zzyjordan
Creator II
Creator II

Hi,
Can you provide some sample data similar to your data structure?
ZZ
uacg0009
Partner - Specialist
Partner - Specialist

Hi,
Do you mean all values for store # 1 should be 13439?
I saw that in aggr(), you also group by the DateCY, could you please try to delete this field?
because I'm not sure why you use the DateCY, it seems like that in your table there is not DateCY as a dimension?
Aiolos Zhao
jonathandienst
Partner - Champion III
Partner - Champion III

You may not need an Aggr() here. How about this?

Sum({$<Type = {'Daily'}, ProductGroup, ProductSubGroup, ProductDetailGroup>} TOTAL <Store> SalesCY)

or

Sum({$<Type = {'Daily'}>} TOTAL <Store> SalesCY)

Add other fields to the total qualifier if needed

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
KAnderson_5
Contributor
Contributor
Author

Removing Aggr() and adjusting to the Total <Store> qualifier you detailed worked perfectly!

Thanks, Jontydkpi!