Forum Discussion
Retrieve Top 10 issues across tables considering variance & errors weightage
- 5 years ago
Hi, sanal5677
According to your description and Follow-up, I can roughly understand your requirement. Then I do some operations in Power BI to get a table similar to your expected table, you can take a look at my steps:
- Finished some merge query and expand table operations in the Power query:
‘Merge1’ is the table I got:
This is the M query in the advanced editor:
let Source = Table.NestedJoin(RunData, {"StepID"}, StepDetails, {"StepID"}, "StepDetails", JoinKind.LeftOuter), #"Expanded StepDetails" = Table.ExpandTableColumn(Source, "StepDetails", {"StepName"}, {"StepDetails.StepName"}), #"Merged Queries" = Table.NestedJoin(#"Expanded StepDetails", {"RunID"}, ParentAppRunMapper, {"RunID"}, "ParentAppRunMapper", JoinKind.LeftOuter), #"Expanded ParentAppRunMapper" = Table.ExpandTableColumn(#"Merged Queries", "ParentAppRunMapper", {"ParentAppID"}, {"ParentAppRunMapper.ParentAppID"}), #"Merged Queries1" = Table.NestedJoin(#"Expanded ParentAppRunMapper", {"ParentAppRunMapper.ParentAppID", "StepID"}, HistoricalRun, {"ParentAppID", "StepID"}, "HistoricalRun", JoinKind.LeftOuter), #"Expanded HistoricalRun" = Table.ExpandTableColumn(#"Merged Queries1", "HistoricalRun", {"Duration"}, {"HistoricalRun.Duration"}) in #"Expanded HistoricalRun"- Apply and close the Power query, then create a calculated table like this:
Table = var _Variance= SELECTCOLUMNS('Merge1',"RunID",[RunID],"VarianceName",[StepDetails.StepName],"Variance",[Variance],"Issue Type","Variance") var _Error= SELECTCOLUMNS('Error',"RunID",[RunID],"VarianceName",[Error],"Variance",[Count],"Issue Type","Error") return UNION(_Variance,_Error)- Create two calculated columns in the table:
weightage = IF( [Issue Type]="Variance"&&[Variance]>0,BLANK(), IF([Issue Type]="Error",[Variance]*10,ABS([Variance]))) Issue ID = RANKX('Table',[weightage],,DESC,Dense)- Create a table and place fields and apply filter like this:
And I guess this can be what you want.
You can download my test pbix file here
Best Regards,
Community Support Team _Robert Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, sanal5677
According to your description and sample data, I read for a long time but I still can not figure out the logic within the columns in the expected table:
As a result, would you like to explain the logic of the value in your expected table one by one so that I can finally understand and help you to achieve your requriement?
Thank you very much!
How to Get Your Question Answered Quickly
Best Regards,
Community Support Team _Robert Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
The TopIssues table gives the summary of the variances between past and current runs along with errors any for that run. For calculating variance the run data (Rundata table) is compared against the historicalrun table and for the errors we use the error table for a given runid. There are two types of issues which we can expect - variance and error. So the 6th table (top issues table) will be a calculated table which provides the summary of those variances and errors by grouping them based on a weightage across the variance and error data. Like i gave an example above saying
- E1 error has occured 10 times
- S1 has a variance of 20 seconds more than the historical run
Then E1 will have more weightage as it has occurred more than 10 times ( threshold ). So the calculation needs to take the weightage and the threshold while arriving at the top 10 issues summary for a given runid by running across the variance and error data.