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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
lamlamm24
Helper I
Helper I

Calculating Hourly Supply

This is what my table looks like before filtering by any clinician to see how many hours they worked. 

 

lamlamm24_0-1709866113227.png

After filtering by a clinician that worked from 12am to 8am on a particular date, lets say 02/11/2024 here is what I have 

((Total of 8hrs in the  12AM Column).

lamlamm24_1-1709866258617.png

 

The challenge I have is that I want the entire 8 hours to be spread across from 12am to 8am something like this. i created this in word for better illustration

lamlamm24_2-1709866637707.png

Here is the DAX i used. 

ClinicianHourSupply =
VAR Start_Time = 'SF_QGENDA'[StartDateTime]
VAR End_Time = 'SF_QGENDA'[EndDateTime]
VAR HourlySupply =
    HOUR(End_Time) - HOUR(Start_Time)
RETURN
HourlySupply.
What can I do to have the hour spread across 12am to 8am as illustrated above. 




 

 

2 REPLIES 2
v-zhouwen-msft
Community Support
Community Support

Hi lbendlin ,thanks for the quick reply.

Hi lamlamm24 ,

Please follow these steps:
1. Use the following DAX expression to create a table

Table  = GENERATESERIES(TIME(1,0,0),TIME(8,0,0),TIME(1,0,0))

2. Use the following DAX expression to create a column(‘HourSupply’: Sum of hours worked after filtering with clinicians on specific dates, I'm assuming a figure of 8.)

Column = DIVIDE([HourSupply] ,8)

3.Use the following DAX expression to create a column

Column2 = SWITCH(TRUE(),
[Value] = TIME(1,0,0),"12am-12:59am",
[Value] = TIME(2,0,0),"1am-1:59am",
[Value] = TIME(3,0,0),"2am-2:59am",
[Value] = TIME(4,0,0),"3am-3:59am",
[Value] = TIME(5,0,0),"4am-4:59am",
[Value] = TIME(6,0,0),"5am-5:59am",
[Value] = TIME(7,0,0),"6am-6:59am",
[Value] = TIME(8,0,0),"7am-7:59am"
)

4.Final output

vzhouwenmsft_0-1712050341662.png

 

lbendlin
Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.