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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
AiolosZhao
Memorable Member
Memorable Member

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





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.

AiolosZhao
Memorable Member
Memorable Member

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





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




hi @AiolosZhao 

 

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.

Hi @unnijoy ,

 

In your sample, 

Mar-20 385

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

 

Aiolos Zhao





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




@AiolosZhao ,

 

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

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





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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