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 amitchandak : Its related to the same data in my earlier post and thanks for your help on that. Since my data set is not as per the actual year (2017 Sep is actually 2016 Sep till 2017 Dec is actually Dec 2016). So the time intelligence doesnt produce the right results even though it works great. So, i was wondering if i can create my own custom YTD function.
Try this
Cumm YTD = CALCULATE(sum('GP Deployed'[Total]),DATESBETWEEN(Dates[Date],STARTOFYEAR(Dates[Date],"8/31"),ENDOFMONTH(Dates[Date])))
I think all other calc is also correct
But remember the sort put sep before Jan, in the case calendar year. So in Cal year 2017. We are seeing sep to dec of another year. Say 2018. And As data start from Jan it shows Jan 2017 to Aug 2017 as one year.
In case of 2018, the cal does not reset on Jan 2018, because it gets data from dec
- sujitjena6 years agoResolver I
amitchandak : You are right and i do understand the system configuration for time intelligence functions. So, as i see it now my only option is to change the data source to reflect the actual year ( Sep - Dec 2017 will change to Sep - Dec 2016 in the period column of fact table "GP Deployed").
Let me know if we can create custom function for YTD and LYYTD for any sort in Months of a year.
Thanks Again!
- amitchandak6 years agoSuper User
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