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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

User filtered report between start date with time and end date with time

I need to report major storm power outages and restorations based on all of the records on or after OutageStartTime and before or on OutageEndTime.  There can be multiple outages starting/restored in the same storm event but on differnet dates and times (think major hurricane).  The end user needs to be able to choose the start and end time based on the exact times in the data.  What is the best way to achieve this?  I am fairly new to Power BI and for obvious reasons filters and slicers aren't working.

 

Major Storm Outage2/26/2008 13:482/26/2008 16:28
Major Storm Outage2/26/2008 13:482/26/2008 13:52
Major Storm Outage2/26/2008 13:492/26/2008 13:51
Major Storm Outage2/26/2008 13:592/26/2008 16:24
Major Storm Outage2/26/2008 14:102/26/2008 16:23
Major Storm Outage2/26/2008 14:102/26/2008 16:21
1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi @Anonymous ;


According to your description, first you have to create a slicertable as a slicer, and then create a measure as a flag. Proceed as follows:
1.Create a new table:

slicertable =
VAR _table1 =
SUMMARIZE ( 'Table', [StartTime] )
VAR _table2 =
SUMMARIZE ( 'Table', [EndTime] )
RETURN
UNION ( _table1, _table2 )

2.Create a flag measure:

flag =
IF (
MAX ( [StartTime] ) >= MIN ( 'slicertable'[Timerange] )
&& MAX ( [EndTime] ) <= MAX ( 'slicertable'[Timerange] ),
1,0)

3. Apply the flag measure into the filter

v-yalanwu-msft_4-1622527468737.png

The final output is shown below:

v-yalanwu-msft_6-1622527474222.png

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-yalanwu-msft
Community Support
Community Support

Hi @Anonymous ;


According to your description, first you have to create a slicertable as a slicer, and then create a measure as a flag. Proceed as follows:
1.Create a new table:

slicertable =
VAR _table1 =
SUMMARIZE ( 'Table', [StartTime] )
VAR _table2 =
SUMMARIZE ( 'Table', [EndTime] )
RETURN
UNION ( _table1, _table2 )

2.Create a flag measure:

flag =
IF (
MAX ( [StartTime] ) >= MIN ( 'slicertable'[Timerange] )
&& MAX ( [EndTime] ) <= MAX ( 'slicertable'[Timerange] ),
1,0)

3. Apply the flag measure into the filter

v-yalanwu-msft_4-1622527468737.png

The final output is shown below:

v-yalanwu-msft_6-1622527474222.png

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

partymia
Frequent Visitor

Why dont you create one date between filter and one for the times, that way you can filter for all.

Anonymous
Not applicable

So if I choose dates between 2/26 and 2/28 and then times between 13:59 and 16:23 wouldn't that filter the hours on each of the days, for example if an outage occured on 2/27 at 12:20, it wouldn't be included?

 

 

No it will be included. Anything between 2/26 and 2/28 is included same for the times.

Hi, @partymia ;

 

if you don't want to included it ,you could use slicer and  press and hold ctrl for multiple selection, select the date and time you want .

v-yalanwu-msft_0-1622596846372.png

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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