Forum Discussion
cottrera
2 years agoPost Prodigy
Distributed Averages
Hi , I have the following table Unit Reference Job# 18 7712012 18 8029903 18 8322638 18 8322662 18 8452691 18 9302275 26 7689550 26 8691041 26 8700602 26 ...
- 2 years ago
Hi cottrera ,
You can refer to below table expression.
Score = VAR TempTable = ADDCOLUMNS(ALL('Table'[Unit Reference]),"Repairs",CALCULATE(COUNTROWS('Table'))) VAR AverageRepairs = ROUND(AVERAGEX(TempTable,[Repairs]),0) VAR ScoreTable = SELECTCOLUMNS( { ("Greater then twice above average",5,AverageRepairs*2+1,99999), ("Between above average and twice above average",4,AverageRepairs+1,AverageRepairs*2), ("Average",3,AverageRepairs,AverageRepairs), ("Between 5 and average",2,6,AverageRepairs-1), ("Between zero and 5",1,1,5), ("Zero",1,0,0) }, "Score Name",[Value1], "Score",[Value2], "Min",[Value3], "Max",[Value4] ) RETURN ADDCOLUMNS( TempTable, "Score Name", MAXX(FILTER(ScoreTable,[Min]<=[Repairs] && [Repairs]<=[Max]),[Score Name]), "Score", MAXX(FILTER(ScoreTable,[Min]<=[Repairs] && [Repairs]<=[Max]),[Score]) )Demo - Distributed Averages.pbix
Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !
Thank you~
cottrera
2 years agoPost Prodigy
Hi thank you for responding. The actual dataset I am using be provided due to company policy. However I have tried to provide some more information on what I would need the DAX to perform.
Note: I have amended score 1 & 2
| Score Mame | Score | Min | Max |
| Greater than twice above average | 5 | > Sum repairs / count properties * 2 | |
| Between above average and twice above average | 4 | Sum repairs / count properties | Sum repairs / count properties * 2 |
| Average Repairs | 3 | Sum repairs / count properties | Sum repairs / count properties |
| Between 5 and average | 2 | 5 | Sum repairs / count properties |
| Between zero and 5 | 1 | 0 | 5 |
| Zero | 1 | 0 | 0 |
xifeng_L
2 years agoSuper User
This information you provided is the criteria for scoring, now I want to know what expected result you need to return or I can't calculate it for you.