Forum Discussion
Power Bi aggregating data till hour level
- 4 years ago
Hi, khush19 ;
You don't need to break my fact data for each row, you could create a hourslicer table as slicer. then create a flag measure .
1.create a table.
hourslicer = GENERATESERIES(1,24,1)2.create a flag measure.
flag = IF(ISFILTERED(hourslicer[Value]), IF ( HOUR ( MAX ( [StartTime] ) ) = SELECTEDVALUE ( 'hourslicer'[Value] ) && MINUTE ( MAX ( [StartTime] ) ) = 0, 1, IF ( HOUR ( MAX ( [StartTime] ) ) < SELECTEDVALUE ( 'hourslicer'[Value] ) && HOUR ( MAX ( [EndTime] ) ) >= SELECTEDVALUE ( 'hourslicer'[Value] ), 1, 0)),1 )3.then apply it into visual filter.
The final output is shown below:
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. - 4 years ago
khush19 Are you wanting a between filter? If so then you don't need any relationship between the Date, Hour and Fact tables. You can do all the filtering with DAX.
Similar to my post about it here: https://excelwithallison.blogspot.com/2020/06/dax-approximate-lookup.html
You'll need to combine the Date/Time selections from both slicers and compare to the Start Date/Time and End Date/Time columns in your Fact table.
If you're still struggling after the blog, let me know and I may have time to provide more specific example.
Hi, khush19 ;
You don't need to break my fact data for each row, you could create a hourslicer table as slicer. then create a flag measure .
1.create a table.
hourslicer = GENERATESERIES(1,24,1)
2.create a flag measure.
flag = IF(ISFILTERED(hourslicer[Value]),
IF (
HOUR ( MAX ( [StartTime] ) ) = SELECTEDVALUE ( 'hourslicer'[Value] )
&& MINUTE ( MAX ( [StartTime] ) ) = 0,
1,
IF (
HOUR ( MAX ( [StartTime] ) ) < SELECTEDVALUE ( 'hourslicer'[Value] )
&& HOUR ( MAX ( [EndTime] ) ) >= SELECTEDVALUE ( 'hourslicer'[Value] ),
1,
0)),1
)
3.then apply it into visual filter.
The final output is shown below:
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.
Thanks alot,i was not sure how to do it,u r genius thanku 🙂