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
PowerBIFreak
Helper II
Helper II

Total of the Pay period but not the grand total

Hi Folks,

 

I tried to search in this community and see if there is any idea to my questions but with no luck. 

 

So, I'm trying to create a dashboard for the percentage of each categories for each pay period. I have two tables as below. The relationship is "Date" and "Posting Date" to return with the pay period for me.

 

On the Hours Table, I have created a measure lets say over time percentage. I simply use the "Over Time"/Total Time to get the percentage. And it seems fine to me. However, when I use the filter to filter out "Pay Period #", the percentage is wrong because lets say if I want to see the pay period 1 of the over time percentage, the formula should be the overtime hours for pay period 1/total hours of pay period 1. If that's the case, does it mean I have to create a measure for each pay period? If yes, since I have 4 categories and I have 26 pay periods, that would be 104 measures???😱😭 I'm so confused! Please help!!!

 

Thank you guys!!!

 

Somehow I think we need to use variable on this issue, am I right?

***Total Time = Sum(Over time, Sick time, Normal Time, Vacation)

 

Calendar Table

DatePay Period #

December 21, 2020

1
December 22, 20201
December 23, 20201
January 4, 20212
January 5, 20212
January 6, 20212
January 7 20212

 

Hours Table

Posting DateCategoryHours
December 22, 2020Normal Time20
December 22, 2020Over Time15
January 4, 2021Sick Time5
January 5, 2021Over Time10
January 6, 2021Vacation 20
1 ACCEPTED SOLUTION
v-easonf-msft
Community Support
Community Support

Hi, @PowerBIFreak 

You can try frormula as below:

Total = SUM('Hours Table'[Hours])+0
Category Percentage = [Total]/ CALCULATE(SUM('Hours Table'[Hours]),ALLSELECTED('Hours Table'[Category]))

Then create a table visual as below:

46.png

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

View solution in original post

3 REPLIES 3
v-easonf-msft
Community Support
Community Support

Hi, @PowerBIFreak 

You can try frormula as below:

Total = SUM('Hours Table'[Hours])+0
Category Percentage = [Total]/ CALCULATE(SUM('Hours Table'[Hours]),ALLSELECTED('Hours Table'[Category]))

Then create a table visual as below:

46.png

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Hello,

 

Thank you very much, this is exactly what I need. I just have another quick question, can we create a variable in this case?

 

Thank you.

Greg_Deckler
Super User
Super User

@PowerBIFreak You will need something like ALL('Calendar'[Pay Period #] in your calculation so that you get all of the pay periods in the calculation even though you have filtered them out on the page or visual or whatever.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.