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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Spencer_J
Frequent Visitor

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
Spencer_J
Frequent Visitor

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

@Spencer_J , 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

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.