Forum Discussion
How to calculate a column with the difference between failed logs
- Anonymous2 years ago
Hi AndreDeLuca ,
Based on my testing, please try the following methods:
1.Create the simple table.
2.Create the new column to calculate the last failure for each row.
Date of Last Failure = VAR date_ = 'Log table'[Date] RETURN CALCULATE( MAX('Log table'[Date]), FILTER( ALL('Log table'), 'Log table'[Date] < date_ && 'Log table'[Log status] = "failed" ) )3.Create the new column to calculate the days since the last failed.
Days Since Last Failure = DATEDIFF( [Date of Last Failure], 'Log table'[Date], DAY )4.Create the new measure to calculate the max days of the column.
Max Days Without Failure = MAXX(ALL('Log table'), [Days Since Last Failure])5.The result is shown below.
Best Regards,
Wisdom Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi AndreDeLuca ,
Based on my testing, please try the following methods:
1.Create the simple table.
2.Create the new column to calculate the last failure for each row.
Date of Last Failure =
VAR date_ = 'Log table'[Date]
RETURN
CALCULATE(
MAX('Log table'[Date]),
FILTER(
ALL('Log table'),
'Log table'[Date] < date_ && 'Log table'[Log status] = "failed"
)
)
3.Create the new column to calculate the days since the last failed.
Days Since Last Failure =
DATEDIFF(
[Date of Last Failure],
'Log table'[Date],
DAY
)
4.Create the new measure to calculate the max days of the column.
Max Days Without Failure = MAXX(ALL('Log table'), [Days Since Last Failure])
5.The result is shown below.
Best Regards,
Wisdom Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Sensational!