Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
GrantBooth
Creator
Creator

YTD Calculation set expression

I am trying to calculate cumulative year to date within an app for a financial year from July to June.

My data contains multiple financial years and already contains a field that maps the date to the financial year.

The date field is month end date, which takes the values 31/07/2021, 31/08/2021 etc. 

Ideally I am looking for a set expression that looks for the sum of all values up to the selected date. So if a user selects FY22 and month August, the script would be something like

sum( {Set expression for July} to {Selected Month} value)

Could anyone please offer some help here? 

Thanks

 

Labels (1)
1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

 

As below

sum({<Datefield={">=$(=Date(yearstart(Max(Datefield),0,7),'YYYY-MM-DD'))<=$(=Date(Max(Datefield),'YYYY-MM-DD'))"}>}Amount)

 

replace YYYY-MM-DD with the dateformat of your datefield

 

refer these posts

 

 

https://community.qlik.com/t5/Qlik-Sense-Documents/Master-Calendar-Script-with-Optional-Fiscal-Year/...

 

https://help.qlik.com/en-US/qlikview/May2021/Subsystems/Client/Content/QV_QlikView/Scripting/DateAnd...

 

https://community.qlik.com/t5/Qlik-Design-Blog/Dates-in-Set-Analysis/ba-p/1472511

 

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

2 Replies
vinieme12
Champion III
Champion III

 

As below

sum({<Datefield={">=$(=Date(yearstart(Max(Datefield),0,7),'YYYY-MM-DD'))<=$(=Date(Max(Datefield),'YYYY-MM-DD'))"}>}Amount)

 

replace YYYY-MM-DD with the dateformat of your datefield

 

refer these posts

 

 

https://community.qlik.com/t5/Qlik-Sense-Documents/Master-Calendar-Script-with-Optional-Fiscal-Year/...

 

https://help.qlik.com/en-US/qlikview/May2021/Subsystems/Client/Content/QV_QlikView/Scripting/DateAnd...

 

https://community.qlik.com/t5/Qlik-Design-Blog/Dates-in-Set-Analysis/ba-p/1472511

 

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
GrantBooth
Creator
Creator
Author

Thanks mate that was exactly what I was after