Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Cameron94
Partner - Contributor III
Partner - Contributor III

Help with YTD expressions

Hi All,

 

I am looking for some help regarding YTD Calculations. 

I have set YTD but it changes with YEAR dimension changes. Is there some way to avoid this and keep the dimension from impacting it? This is my expression: 

sum({<Month = {">$=(Max(Date),0,1))<=$(=Max(Date))"}>}$(vSelected_Portal_Measure))

I am also looking to find a way to type expression for YTD but last year not this year. 

Any help would be appreciated. 

Labels (4)
4 Replies
Chanty4u
MVP
MVP

you want to exclude year selection?

 

sum({<Year=,Month = {">$=(Max(Date),0,1))<=$(=Max(Date))"}>}$(vSelected_Portal_Measure))

vinieme12
Champion III
Champion III

Your expression doesn't make any sense to me

Comparing Max(Date) against  Month field!

sum({<Month = {">$=(Max(Date),0,1))<=$(=Max(Date))"}>}$(vSelected_Portal_Measure))

 

Change to using your Datefield instead and Ignore Year selections in Max(Date) as well

As below

=sum({<Year=,Datefield= {">$(=YearStart(Max({<Year=>}Datefield)))<=$(=Date(Max({<Year=>}Datefield)))"}>}$(vSelected_Portal_Measure))

 

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Cameron94
Partner - Contributor III
Partner - Contributor III
Author

I want to ignore Year selection but I don't want all of the data. What I'm looking for is for the year to stay at 2023. So it will show Jan 1st up until present date. 

I'm quite new to Qlik so don't understand really how all of the language should be used etc. With the above expression it gives me a very large figure, I would imagine it is then showing all years and isn't defined to a singular one. 

Cameron94
Partner - Contributor III
Partner - Contributor III
Author

Hi sorry if this sounds silly but regarding date field im not too familiar with it, could you give me an example of how it should be used? Where the 'datefield' is 

 

Any help is greatly appreciated and thanks for you reply thus far