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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Bobi
Partner - Contributor II
Partner - Contributor II

YTD when selecting month

Hi. I am trying to create a SET expression which is calculating YTD according to my selections in the filter-pane.

 

If I select Booking YearMonth = 201906 in filterpane. I want it to summarize YTD as: jan-june 2019. Then I want it to compare to jan-june 2018. If no selections are made it should show current YTD (2019-01-01 - 2019-11-07) Vs (2018-01-01 - 2018-11-07).

 

Right now the Expression is like this (it works, but it gives "-" when making a selection on booking Yearmonth).

 

Sum({$<$(vL.YTD)>}[Net Sales Amount])
/
Sum({$<$(vL.YTDLY)>}[Net Sales Amount])

 

The variables in the expression are:

vL.YTD = [Booking InYTD]={1},[Booking Year]={"$(=Date(Today(), 'YYYY'))"}

vL.YTDLY = [Booking InYTD]={1},[Booking Year]= {'$(=Year(Today())-1)'}

 

Any suggestions? I have tried different SET expressions.

Labels (2)
2 Replies
sunny_talwar
MVP
MVP

Try changing 

vL.YTD to

[Booking InYTD] = {1}, [Booking Year] = {"$(=Year(Today()))"}, [Booking Yearmonth]

vL.YTDLY to

[Booking InYTD] = {1}, [Booking Year] = {'$(=Year(Today())-1)'}, [Booking Yearmonth]

 

Bobi
Partner - Contributor II
Partner - Contributor II
Author

Hi. Not working.. It shows the same value even if I am doing a selection.

I need it to be dynamical so that if I choose booking yearmonth =201909, then it summarize 201901-201909 and then at the same time summarize for YTDLY: 201801-201809..