Forum Discussion
Filter not working with measure results
- 9 years ago
Yeah, I think that might be the issue.
Athough this still probably only gives you the latest 12 months. There are possibly some better techniques to achieve the same thing. Let us know how you get on.
TRIFR = ( CALCULATE ( SUM ( TRIFR[Fatal] ) + SUM ( TRIFR[Notifiable] ) + SUM ( TRIFR[Lost Time] ) + SUM ( TRIFR[Medical Tretment] ) + SUM ( TRIFR[Reduced Work] ), DATESINPERIOD ( DateKey[Date], LASTDATE ( 'TRIFR'[Incident Date] ), -12, MONTH ) ) * 1000000 ) / CALCULATE ( SUM ( TRIFR[Work Hours] ), DATESINPERIOD ( DateKey[Date], LASTDATE ('TRIFR'[Incident Date] ), -12, MONTH ) )
Created using CALENDAR() and the last date in the table is 30/06/2020
Yeah, I think that might be the issue.
Athough this still probably only gives you the latest 12 months. There are possibly some better techniques to achieve the same thing. Let us know how you get on.
TRIFR
= (
CALCULATE (
SUM ( TRIFR[Fatal] ) + SUM ( TRIFR[Notifiable] )
+ SUM ( TRIFR[Lost Time] )
+ SUM ( TRIFR[Medical Tretment] )
+ SUM ( TRIFR[Reduced Work] ),
DATESINPERIOD ( DateKey[Date], LASTDATE ( 'TRIFR'[Incident Date] ), -12, MONTH )
)
* 1000000
)
/ CALCULATE (
SUM ( TRIFR[Work Hours] ),
DATESINPERIOD ( DateKey[Date], LASTDATE ('TRIFR'[Incident Date] ), -12, MONTH )
)- Sean9 years ago
Community Champion
DATESINPERIOD would work even without a Calendar table!
(which is why I used the same [Incident Date] column in my formula above for both the dates and the start_date )
in case [Incident Date] was not the column used to create the relationship but some other [Date Column]...
unlike DATEADD which requires you to reference a column with contiguous dates :smileyhappy:
- Phil_Seamark9 years ago
Microsoft Employee
I'm guessing the DATESINPERIOD would be slightly quicker not needing to perform I/O on a Calendar table.