Forum Discussion
Comparing Matrix Values using Icons
- 1 year ago
Hi Elisa112 ,
Thanks for reaching out to Microsoft Fabric Community Forum.
Based on the above scenario ,First fetch Previous Score using below DAX query :
PreviousScore = VAR CurrentStudent = Sheet1[StudentID] VAR CurrentStage = 'Sheet1'[AssessmentStage] RETURN CALCULATE( MAX('Sheet1'[Score]), FILTER( 'Sheet1', 'Sheet1'[StudentID] = CurrentStudent && 'Sheet1'[AssessmentStage]= CurrentStage - 1 ) )create a new calucalted cloumn for change direction as below :
ScoreTrend = VAR Curr = 'Sheet1'[Score] VAR Prev = 'Sheet1'[PreviousScore] RETURN IF(ISBLANK(Prev), BLANK(), SWITCH(TRUE(), Curr > Prev, "UP", Curr < Prev, "DOWN", Curr = Prev, "SAME" ) )create a matrix visual and apply conditional formatting the icon set to display up, down, or same arrows based on the ScoreChange.
Below is the expected output :If this post was helpful, please consider marking Accept as solution to assist other members in finding it more easily.
If you continue to face issues, feel free to reach out to us for further assistance!
Hello Elisa112
Try this measure
Score with Trend Arrow =
VAR CurrentStage = SELECTEDVALUE('AssessmentTable'[Rank])
VAR CurrentScore = SELECTEDVALUE('AssessmentTable'[Score])
VAR PreviousScore =
CALCULATE(
MAX('AssessmentTable'[Score]),
FILTER(
'AssessmentTable',
'AssessmentTable'[Student ID] = SELECTEDVALUE('AssessmentTable'[Student ID]) &&
'AssessmentTable'[Rank] = CurrentStage - 1
)
)
VAR TrendArrow =
SWITCH(
TRUE(),
ISBLANK(PreviousScore), "", -- No arrow for first column
CurrentScore > PreviousScore, UNICHAR(9650), -- ↑ Up arrow
CurrentScore < PreviousScore, UNICHAR(9660), -- ↓ Down arrow
CurrentScore = PreviousScore, UNICHAR(8594) -- → Right arrow
)
RETURN
FORMAT(CurrentScore, "0") & " " & TrendArrow
Thanks,
Pankaj Namekar | LinkedIn
If this solution helps, please accept it and give a kudos (Like), it would be greatly appreciated
thank you so much for this, I have tried to use your solution in the matrix, but I am still getting the same result :
Am I doing something wrong here?
- v-aatheeque1 year ago
Community Support
Hi Elisa112 ,
Thanks for reaching out to Microsoft Fabric Community Forum.
Based on the above scenario ,First fetch Previous Score using below DAX query :
PreviousScore = VAR CurrentStudent = Sheet1[StudentID] VAR CurrentStage = 'Sheet1'[AssessmentStage] RETURN CALCULATE( MAX('Sheet1'[Score]), FILTER( 'Sheet1', 'Sheet1'[StudentID] = CurrentStudent && 'Sheet1'[AssessmentStage]= CurrentStage - 1 ) )create a new calucalted cloumn for change direction as below :
ScoreTrend = VAR Curr = 'Sheet1'[Score] VAR Prev = 'Sheet1'[PreviousScore] RETURN IF(ISBLANK(Prev), BLANK(), SWITCH(TRUE(), Curr > Prev, "UP", Curr < Prev, "DOWN", Curr = Prev, "SAME" ) )create a matrix visual and apply conditional formatting the icon set to display up, down, or same arrows based on the ScoreChange.
Below is the expected output :If this post was helpful, please consider marking Accept as solution to assist other members in finding it more easily.
If you continue to face issues, feel free to reach out to us for further assistance!
- Elisa1121 year ago
Helper V
- Elisa1121 year ago
Helper V
Hi v-aatheeque
Unfortunately I am getting blank results in the matrix, as the calculated column you provided does not work, are you able to share the file with me please
thank you
- Elisa1121 year ago
Helper V
can you please send the file again as I cannot access your last message, even though I received an email notification.
thanks again
- v-sathmakuri1 year ago
Community Support
Hi Elisa112 ,
Please find the attachment for working solution. Let us know if you face any difficulties in accessing the file.
If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!
Thanks & Regards,
Rekha,
CustomerSupportTeam.