Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
unnijoy
Post Partisan
Post Partisan

YTD Attrition

I am trying to find the YTD Attrion. Below is the Sample data. I tried using Total YTD and DatesYTD function But these are not gving me the correct values. Please help.

 

MonthAttrition
Jan-20234
Feb-20678
Mar-20385
Apr-20434
May-20294
Jun-20557
Jul-20672
Aug-20508
Sep-20537
Oct-20516
Nov-20285
Dec-20667
Jan-21513
Feb-21611
Mar-21363
Apr-21570
May-21355
Jun-21249
Jul-21462
Aug-21264
Sep-21523
Oct-21360
Nov-21627
Dec-21423
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @unnijoy ,

 

Do you want to calculate an accumulated result?

 

If yes, Plesae try the below measure:

 

measure = calculate(sum(value),filter(all(date),date <= max(date)))

 

Aiolos Zhao

View solution in original post

8 REPLIES 8
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
amitchandak
Super User
Super User

@unnijoy , Are you using time intelligence with Date calendar

 

Like

YTD QTY = TOTALYTD(Sum('order'[Qty]),'Date'[Date])

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-Y...
Or my blog can help

https://community.powerbi.com/t5/Community-Blog/Decoding-Direct-Query-in-Power-BI-Part-1-Time-Intell...

Appreciate your Kudos.

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Anonymous
Not applicable

Hi @unnijoy ,

 

Do you want to calculate an accumulated result?

 

If yes, Plesae try the below measure:

 

measure = calculate(sum(value),filter(all(date),date <= max(date)))

 

Aiolos Zhao

hi @Anonymous 

 

when i use the formula it is giving me diffrernt value. Till up to Feb 2020 it is giving me correct value. Like Jan 2020=234

Feb 2020= 234+678=912. But for March onwards it is giving different value. 

For March as per your formula insted of March 2020=234+678+633=1545 I am getting 1321.  How to fix this.

Anonymous
Not applicable

Hi @unnijoy ,

 

In your sample, 

Mar-20 385

March 2020 is 385, so you will get 234 + 678 + 385 = 1297, right?

 

Aiolos Zhao

@Anonymous ,

 

This issue was with the uploaded data. I refresh the data and i got the values correct. Thanks for your help.

Anonymous
Not applicable

glad to help you @unnijoy 

 

Could you please set my answer as the solution so other people will know the thread is solved.

 

Thanks.

AiolosZhao

Hi @unnijoy ,

Based on your sample data, till up to March 2020, the value should be 234+678+385=1297. Where did 633 come from? Or there are other values in your dataset. Regardless of adding a calendar table to use totalytd() function or calculate values directly by the previous two post, both of them should work.

 YTD.png

Best Regards,
Yingjie Li

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.