Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Streamlining user types in Qlik Cloud capacity-based subscriptions: Read the Details
cancel
Showing results for 
Search instead for 
Did you mean: 
GrantBooth
Creator
Creator

Sum YTD

I'm a little embarrassed to be asking, but I'm having some issues creating a year to date sum using Set Expression.

 

I have a field Amount that I would like to do a YTD sum, with dates ranging from 01/2021 to 12/2021 called FinPeriod. I've been scratching my head all afternoon trying to come up with the expression and it's just not coming together, could someone please point me in the right direction?

 

Cheers

10 Replies
Vegar
MVP
MVP

Duals are a bit tricky when it comes to set analysis. 

Try this (Dynamicly based on max(FinPeriod)):

=Sum({<FinPeriod = {">=$(=Date(Yearstart(max(FinPeriod),0,7), 'MM/YYYY'))<=$(=maxstring(FinPeriod))"}>} Amount)

or this (Staticly based on today()):

=Sum({<FinPeriod = {">=$(=Date(Yearstart(today(),0,7), 'MM/YYYY'))<=$(=date(today(), 'MM/YYYY')) "}>} Amount)

Vegar_0-1632468114427.png

See attached qvf file.