March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
I'm trying to do a 12-month trailing (rolling) calculation of LTIF (Lost Time Incident Frequency) for my report. The calculation formula itself isn't the issue, but I'm having trouble calculating the rolling value of 12 months.
For reference, LTIF is calculated as (Number of injuries)*1000000/(Worked hours)
The calculation consists of two relevant tables. First, we have IncidentReports, which contains the incidents. Each incident has a date of occurance, IncidentReports[Date]. I have also made a measure called [LTI] (with COUNTROWS), which calculates the number of incidents. It works correctly and can be used in the LTIF formula.
The second table is TimeRecords. Each day has multiple rows for worked hours. The relevant columns are TimeRecords[Date] (for which date this row is) and TimeRecords[Hours] (how many hours this record contains).
I also have a Time table. The relevant column is Time[Date], which contains each date. I have relations from IncidentReports[Date] to Time[Date] and TimeRecords[Date] to Time[Date]. I'm aware that this table is needed for the Power BI time intelligence to function, but I'm not sure how.
I have searched the Internet and this forum for help regarding this issue, but I haven't been able to correctly calculate the LTIF for each month. Due to the nature of my data (multiple rows for each day of worked hours and one row for each incident), I can't provide sample data. However, I have attached some sample data that I collected from my visual below. I'm unable to calculate the LTIF measure (rolling 12 months) in Power BI, I calculated them by hand. They coul be used in a table visual or a chart visual for example.
Solved! Go to Solution.
Hi @PowerBI101 ,
You can use date function to convert year month fields to date value and calculate out previous 12 month date, then use convert date value as filter condition to summarize LTIF filed values.
Measure = VAR currYear = MAX ( Table[Year] ) VAR currMonth = MAX ( Table[Month] ) RETURN CALCULATE ( SUM ( Table[LTIF] ), FILTER ( ALLSELECTED ( Table ), DATE ( [Year], [Month], 1 ) >= DATE ( [Year] - 1, [Month], 1 ) && DATE ( [Year], [Month], 1 ) <= DATE ( currYear, currMonth, 1 ) ) )
Regards,
Xiaoxin Sheng
Hi @v-shex-msft
I have a similar measure to calculate 12 months rolling LTIFR, frequency rates.
I have a calculated measure for LTIFR.
I have done the below but it is giving me incorrect values.
Hi @PowerBI101 ,
You can use date function to convert year month fields to date value and calculate out previous 12 month date, then use convert date value as filter condition to summarize LTIF filed values.
Measure = VAR currYear = MAX ( Table[Year] ) VAR currMonth = MAX ( Table[Month] ) RETURN CALCULATE ( SUM ( Table[LTIF] ), FILTER ( ALLSELECTED ( Table ), DATE ( [Year], [Month], 1 ) >= DATE ( [Year] - 1, [Month], 1 ) && DATE ( [Year], [Month], 1 ) <= DATE ( currYear, currMonth, 1 ) ) )
Regards,
Xiaoxin Sheng
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
89 | |
84 | |
70 | |
51 |
User | Count |
---|---|
206 | |
146 | |
97 | |
79 | |
69 |