Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
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!
Solved! Go to Solution.
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.
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.
Hi @rmcmun ,
You can simply do it by fetching the current time and adding 24/24 to it, DAX of the measure would look like:
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!
For that you cna use a 'Relative time slicer'. It will automatically get you the data of last/next 24 hours.
I can add the relative time slicer to add either the last or the next 24 hours, but I don't seem to be able to select BOTH the last and next 24 hours.
Is that possible?
Thanks
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.
Proud to be a Super User!
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?
User | Count |
---|---|
125 | |
106 | |
99 | |
63 | |
62 |
User | Count |
---|---|
135 | |
116 | |
101 | |
71 | |
61 |