Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply

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.

 

kenyaherring93_0-1765292617955.png

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!

1 ACCEPTED SOLUTION

Hello @djurecicK2,

 

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"
)

 

Zanqueta_0-1765298227252.png

 

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 🌀.

 

 

View solution in original post

15 REPLIES 15
Zanqueta
Solution Sage
Solution Sage

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()
)

 

Zanqueta_0-1765294095113.png

 

How to Apply:

  1. Create a Matrix visual with:
    • Rows: TrainingCourse
    • Sub-level: User
  2. Add the measure Status Icon as a value.
  3. 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 🌀.

kenyaherring93_0-1765297730618.png

 

Hello! That worked for me, but now I do not see the total counts at the Training Course level. See below. 

kenyaherring93_1-1765297730938.png

 

How do I only display the icon at the user row-level?

 

Hello! That worked for me, but now I do not see the total counts at the Training Course level. See below. 

kenyaherring93_0-1765297024013.png

How do I only display the icon at the user row-level?

 

Hello @djurecicK2,

 

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"
)

 

Zanqueta_0-1765298227252.png

 

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 🌀.

 

 

Hi! I am almost there, but the status icon is still showing up under training courses that have only ONE USER like here,

kenyaherring93_0-1765300827867.png

 

Everything works fine for courses that have multiple users.

Hi! I am almost there, but the status icon is still showing up under training courses that have only ONE USER like here,

kenyaherring93_0-1765300074849.png

Everything works fine for courses that have multiple users.

try it:

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)
VAR TotalUsers = COUNTROWS(ALL(Query4[User]))
RETURN
SWITCH(
    TRUE(),
    // Case when there is only one user in the current context
    HASONEVALUE(Query4[User]),
        SWITCH(
            TRUE(),
            CompletedFlag = 1, "✔",        // Show check mark if completed
            NotCompletedFlag = 1, "✖",     // Show cross mark if not completed
            BLANK()                         // Otherwise, show nothing
        ),
    // Case when there are multiple users (subtotal or total)
    IF(
        CountCompleted = TotalUsers,       // If all users have completed
        "✔",                               // Show check mark
        CountCompleted & " Completed | " & CountNotCompleted & " Not Completed" // Otherwise, show counts
    )
)

Hi! I just updated the function with this and I still amgetting an X next to course name if it has one user who did not complete. Should say something like "ONE USER COMPLETED". Same thing for a completed user I get check icon next to course name also.

kenyaherring93_0-1765302411347.png

 

Hey!

I'd still like to show the count like "One user completed" like the other rows.

kenyaherring93_0-1765301658252.png

 

Thanks! I put updated the DAX function but I amgetting the same counts for completed and not completed.

kenyaherring93_0-1765299219915.png

 

Please mark it as the correct solution. It helps other community members.

Hi! What will go in place of query4? I get an error that the table does not exists

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 🌀.

djurecicK2
Super User
Super User

Hi @kenyaherring93 ,

 You should be able to do something like this using conditional formatting with icons:

https://www.youtube.com/watch?v=tdDklZ8Jf9c

 

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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.