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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Netope
Helper I
Helper I

Heatmap on Matrix using column and row values

Dear community:

 

Is there a way to use column and row values to color a matrix as a heatmap:

 

This is what I have:

As-is.JPG

And this is what I would like to get:

To-be.JPG

In this example, for color green I would use the following logic:

If value falls in column with value 0 OR 1 OR 2 OR 3 and in row with value 3 then green

 

Thanks in advance for your reply!

 

2 ACCEPTED SOLUTIONS
PijushRoy
Super User
Super User

Yes @Netope 

You can do, please create measure and apply as Background color conditional formatting
Step - Apply conditional table formatting in Power BI - Power BI | Microsoft Learn

If you want to specific answer, please create a sample pbix and share the link (google drive, dropbox, onedrive)
Please share accurate logic for all color



Let me know if that works for you


If your requirement is solved, please mark THIS ANSWER as SOLUTION ✔️ and help other users find the solution quickly. Please hit the Thumbs Up 👍 button if this comment helps you.

Thanks
Pijush
Linkedin




Did I answer your question? Mark my post as a solution!
Appreciate your Like/Kudos

Proud to be a Super User!





View solution in original post

Anonymous
Not applicable

Hi @Netope 

As @PijushRoy  mentioned, you can use conditionfal formatting.

You can refer to the following sample.

vxinruzhumsft_0-1709880904669.png

2.I create a matrix and put the following fields to the matrix.

vxinruzhumsft_1-1709880967916.png

 

3.Create a measure to set the condition of the color.

MEASURE =
VAR a =
    SELECTEDVALUE ( 'Table'[BP Number] )
VAR b =
    SELECTEDVALUE ( 'Table'[Number] )
RETURN
    SWITCH (
        TRUE (),
        a = 0
            && b = 0, "grey",
        a = 1
            && b <= 1
            || a < 1
            && b = 1, "red",
        a = 2
            && b <= 2
            || a < 2
            && b = 2, "yellow",
        a = 3
            && b <= 3
            || a < 3
            && b = 3, "green"
    )

Then put the measure to the conditional formatting of the value field.

vxinruzhumsft_2-1709881045988.png

 

vxinruzhumsft_3-1709881066854.png

 

Output

vxinruzhumsft_4-1709881078315.png

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Netope 

As @PijushRoy  mentioned, you can use conditionfal formatting.

You can refer to the following sample.

vxinruzhumsft_0-1709880904669.png

2.I create a matrix and put the following fields to the matrix.

vxinruzhumsft_1-1709880967916.png

 

3.Create a measure to set the condition of the color.

MEASURE =
VAR a =
    SELECTEDVALUE ( 'Table'[BP Number] )
VAR b =
    SELECTEDVALUE ( 'Table'[Number] )
RETURN
    SWITCH (
        TRUE (),
        a = 0
            && b = 0, "grey",
        a = 1
            && b <= 1
            || a < 1
            && b = 1, "red",
        a = 2
            && b <= 2
            || a < 2
            && b = 2, "yellow",
        a = 3
            && b <= 3
            || a < 3
            && b = 3, "green"
    )

Then put the measure to the conditional formatting of the value field.

vxinruzhumsft_2-1709881045988.png

 

vxinruzhumsft_3-1709881066854.png

 

Output

vxinruzhumsft_4-1709881078315.png

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

Thanks! let me try I'll get back to you

PijushRoy
Super User
Super User

Yes @Netope 

You can do, please create measure and apply as Background color conditional formatting
Step - Apply conditional table formatting in Power BI - Power BI | Microsoft Learn

If you want to specific answer, please create a sample pbix and share the link (google drive, dropbox, onedrive)
Please share accurate logic for all color



Let me know if that works for you


If your requirement is solved, please mark THIS ANSWER as SOLUTION ✔️ and help other users find the solution quickly. Please hit the Thumbs Up 👍 button if this comment helps you.

Thanks
Pijush
Linkedin




Did I answer your question? Mark my post as a solution!
Appreciate your Like/Kudos

Proud to be a Super User!





Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.