Forum Discussion
How to create custom YTD function
- 6 years ago
Please note that all your LTD and LYTD calculations are working correctly. But when trying to display Calendar year and ordered by financial month, it gives the wrong message. Please check my pbix file shared
LYTD GP Total = TOTALYTD(sum('GP Deployed'[Total]),DATEADD(Dates[Date],-12,MONTH),"8/31")https://www.dropbox.com/s/9g9uuqdcbvwexxz/PBIX%20View.pbix?dl=0
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks.
My Recent Blog -
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970
https://community.powerbi.com/t5/Community-Blog/Power-BI-Working-with-Non-Standard-Time-Periods/ba-p/881739
https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601
Hi sujitjena if you mean your fiscal year 2017 start form
Sep 16, Oct 16, Nov 16, Dec 16, Jan 17, Feb 17, Mar 17, Apr17, May 17, Jun17, Jul17, Aug 17
So, like our fiscal year start from Oct 16 - Sep 17 as fiscal year 2017. My dax for YTD as below:
chawalit : I understand the TOTAL YTD function but as i said my data is a bit weird. Please check the sample data set in the below link and let me know if we can have a custom function for YTD and LYYTD
https://www.dropbox.com/sh/kvofpp1iijhy6wa/AAB3JM4s-NHy9GTeQQfoQD3wa?dl=0
Thanks for your help!
- chawalit6 years agoHelper I
sujitjena please check your fiscal year, fiscal month I think is incorrect. Like a fiscal year 2017 you said it will start from Sep 16 - Aug 17. But, in your dataset it start Sep 17, Oct 17, Nov 17, Dec 17, Jan17, Feb 17 - Aug 17. I think after you clear your fiscal year your dax will correct.
- sujitjena6 years agoResolver I
chawalit : Yes you are right - My data set is weird. So, i was wondering if could change the YTD formula instead of correcting the data set. Anyways thanks for your help!
- chawalit6 years agoHelper I
sujitjena Sure, and you should to correct you dax for GP YTD and GP LYYTD like this:
GP YTD = TOTALYTD( [GP Deployed total], Dates[Date], "08-31" )GP LYYTD = CALCULATE( [GP Deployed total], SAMEPERIODLASTYEAR( DATESYTD( Dates[Date], "08-31" ) ) )
the output will look like this: