cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PKnight
New Member

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 @PKnight ;


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 @PKnight ;


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

partymia
Frequent Visitor

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

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?

 

 

partymia
Frequent Visitor

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
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Get Ready for Power BI Dev Camp

Microsoft named a Leader in The Forrester Wave

Microsoft received the highest score of any vendor in both the strategy and current offering categories.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.