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
Applicable88
Impactful Individual
Impactful Individual

Change denominator based on selection in a measure

Hello,
I have a bar chart, where I calculate the workload of a machine perday in %.
I basically sum the amount of the duration in seconds, and using the Divide() function to divide it with a "fix" value of
86400 which equals 24hours:
 
WorkloadPerDay =
DIVIDE(CALCULATE(SUMX('Machine','Machine'[Duration])),86400)
 
The problem I have is when I select nother category in the slicer for "early shift", "late Shift" or "night Shift", I only sum the duration of that selected shift, but its still divided through one day, hhence 86400 seconds. Instead of the time of  just one shift 8hours = 28800 seconds or two shifts.
Is there away to put that all into one measure without the need of unhandy bookmarks and so fourth?
Thank you very much in advance.
Best. 
 
 
 
1 ACCEPTED SOLUTION
Applicable88
Impactful Individual
Impactful Individual

@AntoineTRICHET thanks for your input. I found a method where also a selection of two works perfectly. Its to put another column next to the shift where I have the seconds 28800 for every shift. And then use sum(shiftperseconds). 

Best. 

View solution in original post

2 REPLIES 2
Applicable88
Impactful Individual
Impactful Individual

@AntoineTRICHET thanks for your input. I found a method where also a selection of two works perfectly. Its to put another column next to the shift where I have the seconds 28800 for every shift. And then use sum(shiftperseconds). 

Best. 

AntoineTRICHET
Resolver III
Resolver III

Hi @Applicable88 

You can use SELECTEDVALUE function and do tests (works only if you select one shift).
Another solution is to put in denominator "28800 * COUNTDISTINCT(ShiftType)".
Here ShiftType refers to your column containing the type of shift.

Please accept it as a solution if it solved your issue or provide more details if not

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.