Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
nag78936
Contributor III
Contributor III

If my year starts from april 15th

How to write ytd expression if my company starts from april 15th

Labels (2)
1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

Create these flags in your master calendar and use the flags in set analysis- for calculations

,InYearToDate(Date-if(month(Date)=4,14,0), today(), 0, 4)*-1  as YTD_flag
,InYearToDate(Date-if(month(Date)=4,14,0), today(), -1, 4)*-1 as Prior_YTD_flag

 

sum({<YTD_flag={'1'}>}Amount)

sum({<YTDPrior_YTD_flag_flag={'1'}>}Amount)

 

OR Without flags

sum({<Date={">=$(=Date(YearStart(Max(Date),0,4)+14),'YYYY-MM-DD')<=$(=Date(Max(Date),'YYYY-MM-DD'))"}>}Amount)

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

3 Replies
vinieme12
Champion III
Champion III

As below

 

,InYearToDate(Date-if(month(Date)=4,14,0), today(), 0, 4) as YTD_flag
,InYearToDate(Date-if(month(Date)=4,14,0), today(), -1, 4) as Prior_YTD_flag

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

hi vinieme

can you explain briefly as i am unable to understand which you have posted

vinieme12
Champion III
Champion III

Create these flags in your master calendar and use the flags in set analysis- for calculations

,InYearToDate(Date-if(month(Date)=4,14,0), today(), 0, 4)*-1  as YTD_flag
,InYearToDate(Date-if(month(Date)=4,14,0), today(), -1, 4)*-1 as Prior_YTD_flag

 

sum({<YTD_flag={'1'}>}Amount)

sum({<YTDPrior_YTD_flag_flag={'1'}>}Amount)

 

OR Without flags

sum({<Date={">=$(=Date(YearStart(Max(Date),0,4)+14),'YYYY-MM-DD')<=$(=Date(Max(Date),'YYYY-MM-DD'))"}>}Amount)

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.