Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
ferha_jafri
Partner - Creator III
Partner - Creator III

i want to calculate YTD

Hi everyone i need help as i am not able to find a solution of the problem.I want to calculate Yera To Date sales ,i am able to do it but my issue is that i want to calculate YTD such that it shows me YTD from the starting year as january till the month i select in the calender eg how should i write an expression for the calculation of YTD from jan till mar.

Thanks in advance

Ferha Jafri

1 Solution

Accepted Solutions
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     Try this expression.

     sum({<Date ={">=$(=YearStart(Max(Date)))<=$(=MonthEnd(Max(Date)))"},Year=,month=>}[Sales Amount])

     One more thing. The year for Date :01-04-2004 is wrong in your data it should be 2004 but your data shows it as 2002.

     Check your data properly.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!

View solution in original post

6 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     Have a look at the link below.

     http://community.qlik.com/message/207344#207344

     http://community.qlik.com/thread/2255

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
ferha_jafri
Partner - Creator III
Partner - Creator III
Author

Thanks for your reply ,but nothing is showing in my graph

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     Make sure that you have removed the selection of other fields.

     Something like this in your set analysis.

     Year=,Month=,Quarter=,Day=

     You must unselect the selection you have done.

     If possible send a copy of your Qvw file.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
ferha_jafri
Partner - Creator III
Partner - Creator III
Author

Plz Check i sent the file.

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     Try this expression.

     sum({<Date ={">=$(=YearStart(Max(Date)))<=$(=MonthEnd(Max(Date)))"},Year=,month=>}[Sales Amount])

     One more thing. The year for Date :01-04-2004 is wrong in your data it should be 2004 but your data shows it as 2002.

     Check your data properly.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
ferha_jafri
Partner - Creator III
Partner - Creator III
Author

Thank you so much.