Forum Discussion
Filter +/- 24 hours
Hi all,
I'm trying to filter a visualization so that it displays plus and minus 24 hours from the current time.
E.g., It is now 11:00 Jan 22, so my chart should display from 11:00 Jan 21 to 11:00 Jan 23?
How can I do this?
Thanks so much!
- Anonymous5 years ago
Hi rmcmun ,
You could use the following formula to create a new measure :
Measure = IF ( MAX ( 'Table'[Production output time] ) >= NOW () - 1 && MAX ( 'Table'[Production output time] ) <= NOW () + 1, 1, 0 )And apply it to filter pane(set as "is 1") like this:
Please take a look at the pbix file here.
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
7 Replies
- rmcmunFrequent Visitor
Thanks PC2790 !
I have just posted more clarification in respose to vanessafvg . If I create those measures, how would I then use that to filter the chart?
Thanks!
- PC2790Community Champion
For that you cna use a 'Relative time slicer'. It will automatically get you the data of last/next 24 hours.
- vanessafvgCommunity Champion
can you give more details. do you want this on the slicer, what type of visual are you using. providing the right amount of detail helps to get the right response.
screen shots and sample data help too.
- rmcmunFrequent Visitor
Thanks vanessafvg,
I'm using a line chart and trying to plot expected vs. actual outputs on a production line (see screenshot).
The fact table I'm plotting from (simplifying) has the following fields:
- Production output time (datetime)
- Production output volume (decimal)
- Type (text = actual or expected)
So I need to filter the chart so that it is only displaying the actual vs. expected outputs for -24 hours and +24 hours from now.
Does that make sense?
- AnonymousNot applicable
Hi rmcmun ,
You could use the following formula to create a new measure :
Measure = IF ( MAX ( 'Table'[Production output time] ) >= NOW () - 1 && MAX ( 'Table'[Production output time] ) <= NOW () + 1, 1, 0 )And apply it to filter pane(set as "is 1") like this:
Please take a look at the pbix file here.
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.