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
crumy
Regular Visitor

Assistance accumulating and dividing monthly totals to find YTD percentage

I am new to Power BI and I have searched several different scenarios and I am not finding what I need. I believe this should be fairly simple for those experienced. 

 

I need to produce a report that that shows how many hours per month have been worked  and show a perccentage that shows the performance against target.    (Sum of all months actuals and divided by the Target).  

 

I have created the relationship between the two tables based on month name and that is working.    

 

I can not figure out how to take the total of hours and divide by the YTD Target hours from the other table..     

Data:
One table with information regarding hours worked in a month along with associate. (actuals)
One table with Month names, hours per month and an accumulated YTD total for hour  that should be worked  (target)

crumy_0-1657317082569.png

 

 

crumy_1-1657317119636.png

 

Output

crumy_2-1657317401324.png

I can not figure out how to take the total of hours and divide by the YTD Target hours from the other table..      I do not how to solve the cells highlighed in Green. 

 

 

Thank you in advance!

 

 

1 ACCEPTED SOLUTION
Kishore_Kadhir
Resolver II
Resolver II

Hi,

 

You can try the below steps:

1. Create a calculated column in YTD target table with the below DAX: 

Index = IF('YTD'[Month]="Jan",1, IF('YTD'[Month]="Feb",2, IF('YTD'[Month]="Mar",3))) - There are better ways to write this DAX but let's not get into that
 
2. Create a measure with the following DAX:
YTD % = CALCULATE(SUM(Resource[Hours]), FILTER(ALL('YTD'), 'YTD'[Index] <= MAX('YTD'[Index]))) / SUM('YTD'[YTD Hours])
Kishore_Kadhir_0-1657342651426.png

 Hope this solves your problem. If it does, please consider accepting this as solution.

 

Regards,

Kishore

View solution in original post

2 REPLIES 2
crumy
Regular Visitor

This was very helpful.  Thank you for the easy to follow explanation and code sample. 

Kishore_Kadhir
Resolver II
Resolver II

Hi,

 

You can try the below steps:

1. Create a calculated column in YTD target table with the below DAX: 

Index = IF('YTD'[Month]="Jan",1, IF('YTD'[Month]="Feb",2, IF('YTD'[Month]="Mar",3))) - There are better ways to write this DAX but let's not get into that
 
2. Create a measure with the following DAX:
YTD % = CALCULATE(SUM(Resource[Hours]), FILTER(ALL('YTD'), 'YTD'[Index] <= MAX('YTD'[Index]))) / SUM('YTD'[YTD Hours])
Kishore_Kadhir_0-1657342651426.png

 Hope this solves your problem. If it does, please consider accepting this as solution.

 

Regards,

Kishore

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.

Top Solution Authors