Skip to main content
Announcements
Save $600 on Qlik Connect registration! Sign up by Dec. 6 to get an extra $100 off with code CYBERSAVE: REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
farnsworth
Contributor III
Contributor III

MTD / YTD Is there a better way?

Hi All,

In my data table i'm trying to display MTD and YTD using a calculation which I have stored in a variable "vQuotes" (below). 

SUM({<[Plan Type]={'Actual'}>} Quote_Count)

The fact calendar I have created has flags for MTD and YTD.  What I was hoping to do in the front end data table which in theory should be simple but I can't get this to work is the following :

$(vQuotes) * MTD

and another for YTD


$(vQuotes) * YTD

I can get around this by creating new variable which I would call "vQuotesMTD" and would be as follows:

SUM({<[Plan Type]={'Actual'}, MTD = {1}>} Quote_Count)


But it would mean multiple variables which are only used once and are basically the same.


Is it possible to do this it this way?


$(vQuotes) * MTD


3 Replies
Kushal_Chawda

No this will not work. You are multiplying your expression with MTD Flag i.e 1 means you are actually getting the values for that expression not the MTD values. So you need to use MTD Flag in set analysis SUM({<[Plan Type]={'Actual'}, MTD = {1}>} Quote_Count)

Tanalex
Creator II
Creator II

This may be of value.  It helped me tremendously.

https://qlikcentral.com/2015/11/10/date-comparison-with-a-powerful-calendar/

farnsworth
Contributor III
Contributor III
Author

Hi Kushal & Michael, thanks for you responses.I feared this was the case and thanks for the calendar link this is really useful.