Reply
user_95
Regular Visitor
Partially syndicated - Outbound

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

Syndicated - Outbound

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.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

View solution in original post

2 REPLIES 2
v-stephen-msft
Community Support
Community Support

Syndicated - Outbound

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

Syndicated - Outbound

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.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

avatar user

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)