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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set analysis to calculate YTD and other ranges of dates

Hi,

I need to calculate SUM of categories for YTD which should be the default calculation value when the user opens the Qv application.

For that i doing the following steps:

1. i have a trigger defined when the application open to set and selected the Max year of Date.

2. then I using this expression to calcultate the the SUM of categories for YTD, but is not working:

   =Sum({<Date={'$(=max(Date))'},[YTD Flag]={1}>} NrCategories)

 

   The YTD flag is being calculated with the following condition: if(Year2Date([$(vDateFieldName)], 0, 1, $(vToday)),1)

3.then i also need, to add in the same expression a condition to show the total SUM of the dates selected by the user.

For example, the application starts and the expression should give the sum of YTD by default. Then if the user selects 2015 and 2016 the expression should give the sum of the two Years, the same for months and/or quarters.

Any suggestions or ideas that help me move forward?

Many Thanks

Paulo

11 Replies
sunny_talwar

Can you try this:

Date(MakeDate(YEAR(DataSubmissao), MONTH(DataSubmissao), DAY(DataSubmissao))) as DataSubmissao

and this expression:

=Sum({<Date = {"$(='<=' & Date(Max(Date)))"}, [YTD Flag] = {1}>} NrCategories)

Not applicable
Author

Hi Sunny,

I think now is OK. Is show me the correct values.

Thanks

Paulo