Forum Discussion
How to calculate a column with the difference between failed logs
Hello everyone,
Thanks in advance for anyone that helps,
We have a table that shows us the log of a process, and if it was successful or not:
The idea here is to calculate the record of days without fail. I thought that if i create a column called 'record' that return for each row, the amount of days since the last failed log, we could get the record by creating a measure that returns the max value of the column 'record'. But i cant figure a way to create this column, and dont know if it is possible. If anyone knows a better way to calculate the most days without fail is welcome.
Thanks again.
- 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.
2 Replies
- AnonymousNot applicable
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.
- AndreDeLucaFrequent Visitor
Sensational!