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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
priyarane
Specialist
Specialist

Aggr without Dimension

Hi Community,

I have scenario like below, but the challenge is in my chart there is no dimension but I need to compare with each record of NS.

if we have dimension then we can use if(sum(Sale_X) - sum(Sale_Y)>0, sum(Sale_X) - sum(Sale_Y)), but without dimension I am not getting 10+30(possitve diff value). Can some have any suggestion on this scenario. Need in front end only.

   

NSSale_XSale_YDifference AmountExpected only sum of Possitive difference ammount
A1020-10
B40301010
C80503030
D100120-20

- Priya

1 Solution

Accepted Solutions
sunny_talwar

Or even this might work:

Sum({<NS = {"=Sum(Sale_X) - Sum(Sale_Y) > 0"}>} NS)

Update: My bad, I meant this:

=Sum({<NS = {"=Sum(Sale_X) - Sum(Sale_Y) > 0"}>} Sale_X) - Sum({<NS = {"=Sum(Sale_X) - Sum(Sale_Y) > 0"}>} Sale_Y)

Sample attached

View solution in original post

3 Replies
sunny_talwar

Is this in a text box object? May be try this:

Sum(Aggr(If(Sum(Sale_X) - Sum(Sale_Y)>0, Sum(Sale_X) - Sum(Sale_Y)), NS))

sunny_talwar

Or even this might work:

Sum({<NS = {"=Sum(Sale_X) - Sum(Sale_Y) > 0"}>} NS)

Update: My bad, I meant this:

=Sum({<NS = {"=Sum(Sale_X) - Sum(Sale_Y) > 0"}>} Sale_X) - Sum({<NS = {"=Sum(Sale_X) - Sum(Sale_Y) > 0"}>} Sale_Y)

Sample attached

priyarane
Specialist
Specialist
Author

this is correct but creating performance issue