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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
khisla
Helper II
Helper II

Calculate percentage of hours worked by each employees per day and per store

I am looking for a DAX formula to calculate the percentage that each employee worked from the total of all employee for that specific store and day.  Please see example data and expected results below:

 

תאריךEmployee #StoreHours WorkedTotal Hours WorkedPercentage of total
1/04/20252141446691IL2077.5742.2517.92%
1/04/20252114531961IL2077.942.2518.70%
1/04/20252084683551IL2077.7242.2518.27%
1/04/20252163508841IL2077.6842.2518.18%
1/04/20252163508761IL2074.9342.2511.67%
1/04/20253317250851IL2076.4542.2515.27%
2/04/20252141446692IL2138.0850.1116.12%
2/04/20252114531962IL2137.9750.1115.91%
2/04/20252170302872IL2136.4750.1112.91%
2/04/20252084683552IL2138.0750.1116.10%
2/04/20252142030692IL2138.1750.1116.30%
2/04/20252163508842IL2136.0350.1112.03%
2/04/20253282312202IL2135.3250.1110.62%
2/04/20252141446693IL2247.8747.7816.47%
2/04/20252114531963IL2248.1247.7816.99%
2/04/20253149153233IL2246.6747.7813.96%
2/04/20253275726083IL224847.7816.74%
2/04/20252163508763IL2247.3747.7815.42%
2/04/20252084683553IL2245.5347.7811.57%
2/04/20253317250853IL2244.2247.788.83%
4/04/20252141446694IL1354.7339.5911.95%
4/04/20252114531964IL1356.5839.5916.62%
4/04/20253323244094IL1356.9839.5917.63%
4/04/20253282312204IL1357.1239.5917.98%
4/04/20252084683554IL135739.5917.68%
4/04/20253275726084IL1357.1839.5918.14%
4/04/20253317250855IL2182.789.2130.18%
4/04/20252163508765IL2183.259.2135.29%
4/04/20253222369775IL2183.189.2134.53%

 

1 ACCEPTED SOLUTION
FBergamaschi
Super User
Super User

Here is my result

 

FBergamaschi_0-1753695666970.png

 

File is here

 

https://drive.google.com/drive/folders/1ugiXLln6IhhEMVlDx3v_BvqA23CaITVS?usp=sharing

 

OS I would switch to a dat amodel with a calendar, store and employee dimensions in a star schema but first please tell me if this is what you wanted

 

If this helped, please consider giving kudos and mark as a solution

@me in replies or I'll lose your thread

Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page

Consider voting this Power BI idea

Francesco Bergamaschi

MBA, M.Eng, M.Econ, Professor of BI

View solution in original post

14 REPLIES 14
v-saisrao-msft
Community Support
Community Support

Hi @khisla,

Checking in to see if your issue has been resolved. let us know if you still need any assistance.

 

Thank you.

v-saisrao-msft
Community Support
Community Support

Hi @khisla,

We haven’t heard back from you in a while regarding your issue. let us know if your issue has been resolved or if you still require support.

 

Thank you.

v-saisrao-msft
Community Support
Community Support

Hi @khisla,

Have you had a chance to review the solution we shared earlier? If the issue persists, feel free to reply so we can help further.

 

Thank you.

v-saisrao-msft
Community Support
Community Support

Hi @khisla,

I have recreated your scenario in Power BI Desktop with sample data. Please find the attached pbix file along with the DAX measures for your reference.

vsaisraomsft_0-1754031816349.png

Hope this helps

Thank you.

FBergamaschi
Super User
Super User

Here is my result

 

FBergamaschi_0-1753695666970.png

 

File is here

 

https://drive.google.com/drive/folders/1ugiXLln6IhhEMVlDx3v_BvqA23CaITVS?usp=sharing

 

OS I would switch to a dat amodel with a calendar, store and employee dimensions in a star schema but first please tell me if this is what you wanted

 

If this helped, please consider giving kudos and mark as a solution

@me in replies or I'll lose your thread

Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page

Consider voting this Power BI idea

Francesco Bergamaschi

MBA, M.Eng, M.Econ, Professor of BI

v-saisrao-msft
Community Support
Community Support

Hi @khisla,

Please provide the sample data or the PBIX file along with the expected output, instead of just a screenshot, as this will help us better understand and assist you with your issue.

 

Thank you.

khisla
Helper II
Helper II

Unfortunately none of the above proposed solutions seem to work.  Any other suggestions?

speedramps
Super User
Super User

Hi @khisla 

 

This is a novice question. 😀😀😀

Please consider doing some basic traning before asking questions here.

You will learn a lot faster and better via a structured learning path rather than asking random questions.

You can learn for free here ...

 

To get the total of all employees for a store and/or day

you use the CALCULATE and ALL command to override the natural filter total context 

 

Store total = 
CALCULATE(
    SUM(yourtable[Hours Worked]),
    ALL(yourtable[Employee])
    )

 

For example 

speedramps_0-1753538626962.png

To get the percentage you divide the employee total by the total for all employees 

Employee % = 
VAR this_eeployee  = SUM(yourtable[Hours Worked]) 

VAR all_employees =
CALCULATE(
    SUM(yourtable[Hours Worked]),
    ALL(yourtable[Employee])
    )

RETURN
DIVIDE(
    this_eeployee,
    all_employees
)

 

Like this ...

speedramps_1-1753538885242.png

 

Please click thumbs up and then click [accept solution]

 

 

 

Unfortunatley this does not work.  I am not getting the total hours worked by store by date.

That sounds like a different requirement.

 

Please provide sample data that covers your issue or question completely.
Please show the expected outcome based on the sample data you provided.

Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

lbendlin
Super User
Super User

lbendlin_0-1753537938483.png

use REMOVEFILTERS for that.

 

Store Day contribution = DIVIDE(sum('Table'[Hours Worked]),CALCULATE(sum('Table'[Hours Worked]),REMOVEFILTERS('Table'[Employee #])))

 

 

Greg_Deckler
Community Champion
Community Champion

@khisla Try:

Measure = 
    VAR __Store = MAX( 'Table'[Store] )
    VAR __Date = MAX( 'Table'[Date] )
    VAR __Hours = MAX( 'Table'[Hours Worked] )
    VAR __Table = FILTER( ALL( 'Table' ), [Date] = __Date && [Store] = __Store )
    VAR __AllHours = SUMX( __Table, [Hours Worked] )
    VAR __Result = DIVIDE( __Hours, __AllHours, 0 )
RETURN
    __Result


Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@khisla Calling you attention to this solution as it appears to work perfectly as you can see in these results:

Greg_Deckler_0-1753623199544.png

 



Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

I am getting the same % for all employees

 

khisla_0-1753935217596.png

 

Helpful resources

Announcements
Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.