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: 
AnnieV
Contributor
Contributor

Set analysis, ignore dimension in table

Hi,

I have a table like this (simplified):

Category System Type QTY Calculation
C1 TypeA1 9000 9000
C1 TypeA2 25000 <25000 - 9000>
C1 TypeB 1200 1200

 

For certain System Types I need to subtract the quantity of a different system type to get the correct Calculation value.

The measure I tried is:
SUM({$<CATEGORY={'C1'}, SYSTEM_TYPE={'TypeA2'}>} QTY) - SUM({$<CATEGORY={'C1'}, SYSTEM_TYPE={'TypeA1'}>} QTY)

but this returns 25000 for type A2 instead of 25000-9000.
How can I edit the measure so it shows the correct value?

Labels (1)
4 Replies
Lakshmanan
Partner - Contributor III
Partner - Contributor III

Hi , 

Your expression will give correct result on KPI chart . You should handle this subtraction at the backend in script using peek or if statements or variable. 



Please mark as Closed if it resolved the issue.
Or
MVP
MVP

Seems like you should be using Above() for this.

QTY - if(System = 'A1',Above(QTY),0)

Working in whatever conditions you need.

Lakshmanan
Partner - Contributor III
Partner - Contributor III

i have tried the above function ,but still in straight table ,it shows different output.

Lakshmanan_0-1692280011795.png

 

Or
MVP
MVP

I'm not sure what that table is meant to show, exactly, but the Above() formula in the rightmost column doesn't make sense. It seems to only apply Above() to the ID in the first row, and for the first row, there is no Above() because it's, well, first.