March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi
I am trying to calculate the proportion of hours when we have to move people to a different store/dept due to staffing levels.
I have the number of hours that they were moved for and the total hours worked.
However when i do a sum of total hours worked it is giving me the total hours for everyone that has worked on that day not just the ones that were moved. In the below example it is giving me 1360 as total hours worked when it should be 69.5. I am only using Sum(hours worked) as the calculation, if i put into the filter total hours worked is not blank this works but i cant use this in a card visual ideally i want to do this in a measure if possible, not sure if it needs a selectedvalue or allselected.
Date | Team | Hours Moved Location | Total Hours Worked |
13/05/2024 | 1 | 35.15 | 51.5 |
13/05/2024 | 2 | 31.5 | 18 |
Total | 66.65 | 1360 | |
should be | 69.5 |
Solved! Go to Solution.
Actually, wrap this expression in SUMX. Does your model have a date table? If not, it's best practice to create a date table. In this example, the date table is 'Date' and has a relationship with the data (fact) table. The date field in the visual should be from the Date table.
Total Hours Worked =
SUMX (
VALUES ( 'Date'[Date] ),
IF ( NOT ISBLANK ( [Hours Moved Location] ), SUM ( Table[Hours Worked] ) )
)
Proud to be a Super User!
Hi @maurcoll ,
Thanks for @DataInsights reply.
Here some steps that I want to share, you can check them if they suitable for your requirement.
Here is my test data:
Create a measure
Total Hours Worked =
CALCULATE(
SUM('Table'[Hours Worked]),
FILTER(
'Table',
'Table'[Hours Moved Location] <> BLANK()
)
)
Final output
Best regards,
Albert He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
One idea is to check the Hours Moved Location value: if it has a value then sum Hours Worked:
Total Hours Worked =
IF ( NOT ISBLANK ( [Hours Moved Location] ), SUM ( Table[Hours Worked] ) )
Proud to be a Super User!
Actually, wrap this expression in SUMX. Does your model have a date table? If not, it's best practice to create a date table. In this example, the date table is 'Date' and has a relationship with the data (fact) table. The date field in the visual should be from the Date table.
Total Hours Worked =
SUMX (
VALUES ( 'Date'[Date] ),
IF ( NOT ISBLANK ( [Hours Moved Location] ), SUM ( Table[Hours Worked] ) )
)
Proud to be a Super User!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
129 | |
90 | |
75 | |
58 | |
53 |
User | Count |
---|---|
200 | |
104 | |
101 | |
67 | |
55 |