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: 
Kaushik2020
Creator III
Creator III

How to show data for Sales based on products from Previous year

Dear All, 

I have below data. 

Year ProductName Sales
2023 A 10
2023 B 20
2024 A 20
2024 B 30
2024 C 50

 

Assuming current year as 2024, I want to show ProductName from Last year. 

Here I want to show show sales for 2024 where ProductName = A and B (from Previous year)

Thanks in advance.

3 Replies
Chanty4u
MVP
MVP

Try this 

Sum({<Year={2024}, ProductName={"=ProductName = {'$(=Concat({<Year={2023}>} ProductName, ','))'}"}>} Sales)

 

Kushal_Chawda

@Kaushik2020  try below

Sum({<Year={"$(=max(Year)-1)"} ProductName=p({1<Year={"$(=max(Year))"}>}ProductName)>} Sales)

Kushal_Chawda

@Kaushik2020  It seems you need to sshow sales of previous year product to current year so try below

Sum({<Year={"$(=max(Year))"} ProductName=p({1<Year={"$(=max(Year)-1)"}>}ProductName)>} Sales)