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

Dynamic Year to Date Calculation

Hello,

 

I am quite new to Qulikview. I am trying to create a Calculation for the Year to Date. The Goal is that I can still choose the month and Year from the filter, so the Year to date is calculated accordingly.  The fields  that I have are Month Year and Salesamount. The Salesamount is aggregated on monthly bases. 

I tried to flag the Month from starting of the year until today() with a 1 in the loadscript, but then I cannot choose the months from the filter anymore because it is fix in Set expression statement.

 

In forum I found this solution:

sum({<Year=, Month=,CalDate= {'>=$(=YearStart(Max(CalDate)))<=$(=Max(CalDate))'}>}NetCount)

 

Anyone knows how to adapt it to my case or can help me with an own solution?

Thank you!!

Labels (2)
2 Replies
Vegar
MVP
MVP

Try
SUM({<
Year={"$(=MAX(Year))"},
Month={"<=$(=MAX(Month))"},
>}
Salesamount)

You might need to change the max(Month) to maxstring(Month) depending how Month is stored.
sabmaldun4
Contributor
Contributor
Author

This helped me.
Thank you very much 😃