Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

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

  • 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

    • Anonymous's avatar
      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
  • Anonymous's avatar
    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