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
Anonymous
Not applicable

Custom Date Parameters

Hi, I have a report with calculations based on the typical calendar day. However, I've been tasked with reporting my calculations to overlap to 2 calendar days i.e. between 5pm (previous day) to 5pm (next day).

How would I approach this since all my calculations are linked to my calendar table? I know the question maybe vague so here's an example:

I have a measure that calculates the total amount of job bookings in a day and they range from 12 midnight to 11.59pm. Now I need to calculate total job bookings between 5pm (previous day) to 5pm (next day). Hope that makes sense.

 

Appreciate any suggestions. Thanks. 

 

 

10 REPLIES 10
kentyler
Solution Sage
Solution Sage

You might consider that you need a calendar table with the granularity of hours, rather than the normal days. Then on each row you put a new "day" value that corresponds to your 5:00 to 5:00 day.

Then if you have records with date/time values hooked up to a date/time field in your calendar table..you can query for the records in a "day", meaning your offset row, and you can count the number of records in that "offset" "day"





Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


Anonymous
Not applicable

@kentyler Thank you for responding. Do you have a sample calendar table I can reference?

https://www.youtube.com/watch?v=BtYn1hfdSAM





Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


Anonymous
Not applicable

Hi @kentyler I was hoping for sample calendar table with granularity in hours as you suggested...

sorry, I would build something like that in Access or Excel, but I don't have one already to hand





Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


Anonymous
Not applicable

I'm also building this in Excel PowerPivot so was hoping if you could provide a sample date table with hours and some sample mock data to show how to calculate the offsets and integrate/link with my existing date table? If not possible, then no problem I'll reach out to other members in the forum. Thanks. 

sorry, that's a lot of work for a forum like this





Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


This morning I had a new idea. Instead of listing every hour of every day in your calendar, you could create a separate table that had one row for each hour in the day. That row would include a field with an offset value...the value you need to add to the day for that particular hour. Up til 5 the offset would be 0, 5 and after it would be 1.

Then you can calculate the "business day" in any measure or calculated column by using DATEADD() to add the offset to the "calendar day".

This would mean you split your date time into a "date" and "hour" column, so you could link the hour column to your lookup table for hours.

 





Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


Anonymous
Not applicable

Thanks but am more of a visual person to help me understand, perhaps you could provide screenshot of a sample date table with your suggestion?

 

here is a sample "hour" table

HourDay Offset
10
20
30
40
50
60
70
80
90
100
110
120
130
140
150
160
171
181
191
201
211
221
231
241




Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


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.

Top Solution Authors