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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
user_95
Frequent Visitor

Place measure in matrix row section and conditionally format it

Hello all,

I am trying to build a matrix visual similar to below. However, I am facing issue with placing the Availability% KPI in the desired location as per the requirement and conditionally formatting it.

I have created the desired matrix visual and calculated this KPI as a measure separately, but unable to place it in the same matrix, as measures can't be added under matrix rows. I tried to create it as a column as well but the DAX is not returning the right results and even if I do resolve it, it would need to be placed under rows (but matrix rows don't have conditional formatting). It would be helpful if there is any way I can place it atleast at the end in the Values section as well (like a total), but the date field in column must not impact it.

Below is the required design and what I have built in PBI currently.

Availability% = DIVIDE(DISTINCTCOUNT(Date),7)


Would appreciate if you have any idea to get it in the desired format. Thanks! 

 

Required Design

user_95_0-1739704877998.png

 

Current Report

user_95_1-1739705260574.png

 

 

 

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not 100% sure if I understood your question correctly, but I tried to create a sample pbix file like below.

One of ways is to create a new table (column table) for the purpose of making the column values in the matrix visual like below.

Jihwan_Kim_1-1739710478032.png

 

Jihwan_Kim_0-1739710451580.png

 

available %: = 
VAR _alldates =
    COUNTROWS ( 'calendar' )
VAR _available =
    COUNTROWS ( FILTER ( data, data[available] = 1 ) )
VAR _t =
    ADDCOLUMNS (
        VALUES ( 'calendar'[date] ),
        "@availability%",
            CALCULATE (
                DIVIDE (
                    COUNTROWS ( FILTER ( data, data[available] = 1 ) ),
                    COUNTROWS ( 'calendar' )
                )
            )
    )
RETURN
    IF (
        HASONEVALUE ( location[location] ),
        SWITCH (
            TRUE (),
            SELECTEDVALUE ( column_table[column] ) = "Availability %",
                DIVIDE (
                    COUNTROWS ( FILTER ( data, data[available] = 1 ) ),
                    COUNTROWS ( 'calendar' )
                ),
            MAXX (
                FILTER ( _t, 'calendar'[date] = MAX ( column_table[column] ) ),
                [@availability%]
            )
        )
    )

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @user_95 ,

 

Pls has your problem been solved? If so, accept the helpful reply as a solution or share us with your own insights. This will make it easier for the future people to find the answer quickly.
If not, please provide a more detailed description about it.

Best Regards,
Stephen Tao

 

Jihwan_Kim
Super User
Super User

Hi,

I am not 100% sure if I understood your question correctly, but I tried to create a sample pbix file like below.

One of ways is to create a new table (column table) for the purpose of making the column values in the matrix visual like below.

Jihwan_Kim_1-1739710478032.png

 

Jihwan_Kim_0-1739710451580.png

 

available %: = 
VAR _alldates =
    COUNTROWS ( 'calendar' )
VAR _available =
    COUNTROWS ( FILTER ( data, data[available] = 1 ) )
VAR _t =
    ADDCOLUMNS (
        VALUES ( 'calendar'[date] ),
        "@availability%",
            CALCULATE (
                DIVIDE (
                    COUNTROWS ( FILTER ( data, data[available] = 1 ) ),
                    COUNTROWS ( 'calendar' )
                )
            )
    )
RETURN
    IF (
        HASONEVALUE ( location[location] ),
        SWITCH (
            TRUE (),
            SELECTEDVALUE ( column_table[column] ) = "Availability %",
                DIVIDE (
                    COUNTROWS ( FILTER ( data, data[available] = 1 ) ),
                    COUNTROWS ( 'calendar' )
                ),
            MAXX (
                FILTER ( _t, 'calendar'[date] = MAX ( column_table[column] ) ),
                [@availability%]
            )
        )
    )

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.