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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

2-Day Custom Time Range for Visual

Hello!

 

I am trying to include data in a bar graph that spans 2 days. Within this data, it is divided into 2 shifts. Let's call them 1 and 2. This data contains time stamps for each line item of data. I want to create a page for the 2nd shift which spans from 4pm to 2am. The issue I am running into, is including the previous days data. For example, if right now it's 1am, I want to include all data from 4:30pm from previous day until 1am right now. But, if it's 11pm, I only want to include 4pm-11pm in the graph. I have tried date filters, but seeing difficulty with data needed across 2 days. 

 

In my data, the time stamp can be whole hour or full date time stamp. I have a custom column for 1-24 (hours) and a full time stamp column. 

 

Any help would be greatly appreciated! 

 

Thank you!

3 REPLIES 3
Anonymous
Not applicable

Hi Amit, I had this exact formula and the issue I am having is it's adding the previous days same shift to my current day. So now, my visual for 'today' is not adding the previous days line items if it's after midnight. If that doesn't make sense, let me know and I can make an example file in Power BI. 

 

Thank you!

Spencer

amitchandak
Super User
Super User

@Anonymous , In such case I prefer to move date example

 

if(timevalue([DateTime])<time(4,0,0) , datevalue([Datetime]) -1, datevalue([Datetime]) )

 

this will force same date for any time before 4 AM as 2PM - Shift start date

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Here's another example. Let's just say we want a visual to total the amount for this shift. Currently summing the amount but it's summing from the same shift but the day before. 

 

DateHourAmount
13-Dec7100
13-Dec8200
13-Dec9300
13-Dec10400
13-Dec11200
13-Dec12600
14-Dec1800
14-Dec2400

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors