Forum Discussion
Conditional Formatting with Matrix Table
Hi! I am want to set up my matrix table so that when someone expands on a training course in my table the user will see a check icon if the course is completed and an "X" icon if the course is not completed.
In this pic above you see if there's a 1 either in the Completed or Not Completed column it should mark accordingly.
Willing to send a pbx file also!
Hello djurecic,
Sorry but I initially misunderstood your requirement, assuming you only needed icons at the user level. The measure you shared changes the DAX logic because it now combines two behaviours: displaying icons for individual users and showing aggregated counts for totals. This requires context evaluation using HASONEVALUE() to distinguish between detail and subtotal levels
The approach works correctly, but note:- It behaves differently from the original icon-only measure.
- You will need to adapt table and column names (e.g., Query4) to match your data model.
Status Icon or Count = VAR CompletedFlag = SELECTEDVALUE(Query4[Completed], 0) VAR NotCompletedFlag = SELECTEDVALUE(Query4[NotCompleted], 0) VAR CountCompleted = CALCULATE(COUNTROWS(Query4), Query4[Completed] = 1) VAR CountNotCompleted = CALCULATE(COUNTROWS(Query4), Query4[NotCompleted] = 1) RETURN SWITCH( TRUE(), HASONEVALUE(Query4[User]), SWITCH( TRUE(), CompletedFlag = 1, "β", NotCompletedFlag = 1, "β", BLANK() ), // Caso seja subtotal (mais de um utilizador) CountCompleted & " Completed | " & CountNotCompleted & " Not Completed" )If this response was helpful in any way, Iβd gladly accept a πmuch like the joy of seeing a DAX measure work first time without needing another FILTER.
Please mark it as the correct solution. It helps other community members find their way faster (and saves them from another endless loop π.
15 Replies
- ZanquetaSuper User
Hello kenyaherring93,
My recommendation for this scenario is to apply a DAX function to control the logic for displaying icons in the matrix. This approach ensures the solution is dynamic, scalable, and calculated in the context of the visual, without the need for calculated columns.β
Status Icon = VAR CompletedFlag = SELECTEDVALUE(Query4[Completed], 0) VAR NotCompletedFlag = SELECTEDVALUE(Query4[NotCompleted], 0) RETURN SWITCH( TRUE(), CompletedFlag = 1, "β", NotCompletedFlag = 1, "β", BLANK() )How to Apply:
- Create a Matrix visual with:
- Rows: TrainingCourse
- Sub-level: User
- Add the measure Status Icon as a value.
- The result will display β for completed courses and β for not completed courses.
If this response was helpful in any way, Iβd gladly accept a πmuch like the joy of seeing a DAX measure work first time without needing another FILTER.
Please mark it as the correct solution. It helps other community members find their way faster (and saves them from another endless loop π.
- kenyaherring93Helper I
Hi! What will go in place of query4? I get an error that the table does not exists
- ZanquetaSuper User
Exactly kenyaherring93 . Query4 is the nome I used to reproduce you scenario. You need to adapt the function in your data model.
Do you need to replace Query4 to your data table.
If this response was helpful in any way, Iβd gladly accept a πmuch like the joy of seeing a DAX measure work first time without needing another FILTER.
Please mark it as the correct solution. It helps other community members find their way faster (and saves them from another endless loop π.
- kenyaherring93Helper I
Hello! That worked for me, but now I do not see the total counts at the Training Course level. See below.
How do I only display the icon at the user row-level?
- ZanquetaSuper User
Hello djurecic,
Sorry but I initially misunderstood your requirement, assuming you only needed icons at the user level. The measure you shared changes the DAX logic because it now combines two behaviours: displaying icons for individual users and showing aggregated counts for totals. This requires context evaluation using HASONEVALUE() to distinguish between detail and subtotal levels
The approach works correctly, but note:- It behaves differently from the original icon-only measure.
- You will need to adapt table and column names (e.g., Query4) to match your data model.
Status Icon or Count = VAR CompletedFlag = SELECTEDVALUE(Query4[Completed], 0) VAR NotCompletedFlag = SELECTEDVALUE(Query4[NotCompleted], 0) VAR CountCompleted = CALCULATE(COUNTROWS(Query4), Query4[Completed] = 1) VAR CountNotCompleted = CALCULATE(COUNTROWS(Query4), Query4[NotCompleted] = 1) RETURN SWITCH( TRUE(), HASONEVALUE(Query4[User]), SWITCH( TRUE(), CompletedFlag = 1, "β", NotCompletedFlag = 1, "β", BLANK() ), // Caso seja subtotal (mais de um utilizador) CountCompleted & " Completed | " & CountNotCompleted & " Not Completed" )If this response was helpful in any way, Iβd gladly accept a πmuch like the joy of seeing a DAX measure work first time without needing another FILTER.
Please mark it as the correct solution. It helps other community members find their way faster (and saves them from another endless loop π.
- kenyaherring93Helper I
Hello! That worked for me, but now I do not see the total counts at the Training Course level. See below.
How do I only display the icon at the user row-level?
- Create a Matrix visual with:
- djurecicSuper User
Hi kenyaherring93 ,
You should be able to do something like this using conditional formatting with icons:
https://www.youtube.com/watch?v=tdDklZ8Jf9c
- kenyaherring93Helper I
Hey! I tried using CF but the issue is when it is a 1 under "Not Completed" column it still puts a checkbox icon. It should be 1 under not completed= "X" icon