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

MTD, QTD and YTD analysis in a single set expression

Hi All,

  I have a requirement where I need to get sum(quantity) for previous year, the catch is when we have no Month,Year,Quarter or MonthYear selection we should have PYTD value in the expression and if we select any month the expression should give us value for PYMTD, same with quarter or year.

Example:

I have no selection the expression should give me sum(quantity) for 01/01/2020 - 12/31/2020

If I select Nov-21, the expression should return sum(quantity) 01/11/2020 - 31/11/2020

If I select Q1, the expression should return sum(quantity) for 01/01/2020 - 03/31/2020

 

 

This is the expression i am using, this works perfectly with Month/Year/Quarter but fails when i select MonthYear

sum({<INCOTERMS={'Delivered'},Month=,Year=,QuarterYear=,Week=,WeekYear=,MonthYear=,
Date={">=(=AddYears((min( {< Year={'>=$(=(Max(Year-1)))'} >} Date)),0)) <=$(=AddYears(max(Date),-1))"}>} Quantity)

 

0 Replies