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
bhmiller89
Helper V
Helper V

Measures to Show Availability

I have a table called "SR Data" which is a list of every scheduled "service request" that has a start date/time and an end date/time.

 

Users are schedule 8 hours a day.  Either two visits: one 4 hour in the morning and one 4 hours in the afternoon, or one 8 hour visit.

 

I'm trying to show user availability by day. I tried:

IF(SUM(SR Duration) <8, "Avail", "Booked") but it doesn't seem like I'm getting what I need.

 

Also, I'd ideally like to show if the scheduled SR and the availability are for AM, PM, or All day.

1 ACCEPTED SOLUTION

@bhmiller89

 

I notice that you already have a date column in your table. You can create a column to calculate the time difference between StartDate and EndDate. 

 

Duration = DATEDIFF(Table[StartDate], Table[EndDate], HOUR)

Then you need to calculate the duraion group on day and contact and use it in IF() condition. 

Availability = IF(CALCULATE(SUM(Table[Duration]),ALLEXCEPT(Table,Table[Date],Table[Contact]))<8,"Avail","Booked")

Regards,

View solution in original post

5 REPLIES 5
Greg_Deckler
Super User
Super User

Can you post some sample data and your current results versus what results you would like?


@ 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...

@Greg_Deckler  I was able to create a column that tells me if a scheduled request fills the "AM", "PM", or "ALL DAY" slot.  Now my problem is: now every user has a scheduled request on each day.  So, I need to find a way to show ALL dates, not just those with scheduled requests.

 

I have the scheduled request date and my date table as a relationship. The user and the start date of the request show up, but not the generic date from the date table.  Is this a problem with my relationship or do I need to write a measure to say something like 

 

"If no scheduled request on a date, show date anyway"? 

 

Capture.JPG

@bhmiller89

 

I notice that you already have a date column in your table. You can create a column to calculate the time difference between StartDate and EndDate. 

 

Duration = DATEDIFF(Table[StartDate], Table[EndDate], HOUR)

Then you need to calculate the duraion group on day and contact and use it in IF() condition. 

Availability = IF(CALCULATE(SUM(Table[Duration]),ALLEXCEPT(Table,Table[Date],Table[Contact]))<8,"Avail","Booked")

Regards,

So I have a list of scheduled SRs but I can't figure out a way to show every single date but with a "0" for duration on dates that don't have a scheduled SR.

 

So, if no SR is schedule on a date, show 0.

Also, needs to be for each User.

 

"If User does not have SR scheduled on this date, show a 0 for scheduled duration (time)"

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.