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: 
ProfPhidd
Partner - Contributor
Partner - Contributor

Subtracting Sales for 2021 from Sales for 2022

I have a Crosstab showing Sales nesting 2021 and 2022 columns.  I would like to create a third column representing the difference between 2021 and 2022 Sales.  How do I do this? 

AP

ProfPhidd_0-1672108305962.png

 

Labels (2)
1 Reply
Taoufiq_Zarra

@ProfPhidd 

if you always compare the current year with the previous year you can change sum(sales) to have two measures

=Sum({$<Year={$(=max(Year)-1)} Sales) ---> for 2021

=Sum({$<Year={$(=max(Year))} Sales) ----> for 2022

and then add measure difference

=Sum({$<Year={$(=max(Year))} Sales)-Sum({$<Year={$(=max(Year)-1)} Sales)

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉