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: 
iamirzasad
Contributor II
Contributor II

YTD, FYTD Calculations

Hi 

I am learning Qlik Sense and I want to make a date comparison of YTD, MTD, FYTD

can someone please guide me on how to write a set expression step by step and write a code for YTD, FYTD, and MTD till the date selected in the date picker, not today's day

Labels (4)
2 Solutions

Accepted Solutions
vinieme12
Champion III
Champion III

As below

YTD = sum({<Date={">=$(=Date(YearStart(max(Date)),'YourDateFormat'))<=$(=Date(Max(Date),'YourDateFormat')"}>}Amount)

MTD = sum({<Date={">=$(=Date(MonthStart(max(Date)),'YourDateFormat'))<=$(=Date(Max(Date),'YourDateFormat')"}>}Amount)

FYTD = sum({<Date={">=$(=Date(YearStart(max({1}Date)),'YourDateFormat'))<=$(=Date(Max({1}Date),'YourDateFormat')"}>}Amount)

 

 

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

View solution in original post

vinieme12
Champion III
Champion III

so FYTD is fiscal ytd I assumed it was Full Year ToDate;

FYTD  = sum({<Date={">=$(=Date(YearStart(max(Date),0,4),'YourDateFormat'))<=$(=Date(Max(Date),'YourDateFormat')"}>}Amount)

The above assumes April as the first month of the fiscal year, you can modify it as needed

 

refer below on how to generate a fiscal calendar

https://community.qlik.com/t5/QlikView-Documents/Fiscal-and-Standard-Calendar-generation/ta-p/148082...

 

 

 

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

View solution in original post

5 Replies
vinieme12
Champion III
Champion III

As below

YTD = sum({<Date={">=$(=Date(YearStart(max(Date)),'YourDateFormat'))<=$(=Date(Max(Date),'YourDateFormat')"}>}Amount)

MTD = sum({<Date={">=$(=Date(MonthStart(max(Date)),'YourDateFormat'))<=$(=Date(Max(Date),'YourDateFormat')"}>}Amount)

FYTD = sum({<Date={">=$(=Date(YearStart(max({1}Date)),'YourDateFormat'))<=$(=Date(Max({1}Date),'YourDateFormat')"}>}Amount)

 

 

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

Thank you so much for this solution it works fine against YTD, MTD

but I want to understand how the Fiscal year to date is working?  

vinieme12
Champion III
Champion III

so FYTD is fiscal ytd I assumed it was Full Year ToDate;

FYTD  = sum({<Date={">=$(=Date(YearStart(max(Date),0,4),'YourDateFormat'))<=$(=Date(Max(Date),'YourDateFormat')"}>}Amount)

The above assumes April as the first month of the fiscal year, you can modify it as needed

 

refer below on how to generate a fiscal calendar

https://community.qlik.com/t5/QlikView-Documents/Fiscal-and-Standard-Calendar-generation/ta-p/148082...

 

 

 

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

Thank you So much its working fine now

vinieme12
Champion III
Champion III

happy to help

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