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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
JyotiChiluka
New Member

Issue in highlight cells in matrix visual of 2 diff tables values via measure conditional formatting

- Issue in highlighting the difference of two tables in matrix visual via measure in conditional formatting


I have 2 tables; Raw and Source - both the table have same columns Business unit, Table names and Record.
In matrix visual I have the row hierarchy level as first business unit and then tables names and values of matrix is record count.
Raw data: 

Business unitTable namesRecord Count
LONDONLONDON EYE123
LONDONSEA SIDE344
LONDONLONDON BRIDGE555
LONDONTOWER BRIDGE359
USANEW YORK9087
USALOS ANGELES868
USACALIFORNIA3849
USADALLAS276

 

Source data:

Business unitTable namesRecord Count
LONDONLONDON EYE123
LONDONSEA SIDE344
LONDONLONDON BRIDGE850
LONDONTOWER BRIDGE359
USANEW YORK9087
USALOS ANGELES868
USACALIFORNIA5468
USADALLAS276



I want to highlight the table names and business unit, if any of the matches the table names and bussiness unit check the record count from if the source data - record count is greater than raw table record count, then highlight the record counts values in matrix in source table.
Here I have kept as table format, but in Power BI Desktop I am using it as matrix.
In above reference table I have highlighted the text, but I want to highlight the background cells in matrix visual via measure conditional formatting.

What I am looking for is if there is mismatch of the record count for each table name and business unit or the record count(source data) is greater than the other table(raw data), In my matrix visual i want to highlight the record count values in the source table  


For reference I am attaching the measure which I am using.

HighlightDifference_Counts =

VAR CurrentBusinessUnit = SELECTEDVALUE('DB_SRC SRC_TBL_STATS'[BUSINESS_UNIT])

VAR CurrentFileName = SELECTEDVALUE('DB_SRC SRC_TBL_STATS'[SRC_TABLE_NAME])

 

VAR SrcTableCount = COUNTROWS(

    FILTER(

        'DB_RAW RAW_TBL_STATS_V_for_SRC',

        'DB_RAW RAW_TBL_STATS_V_for_SRC'[TABLE_NAME] = CurrentFileName &&

        'DB_RAW RAW_TBL_STATS_V_for_SRC'[BUSINESS_UNIT] = CurrentBusinessUnit

    )

)

 

VAR RawTableCount = COUNTROWS(

    FILTER(

        'DB_SRC SRC_TBL_STATS',

        'DB_SRC SRC_TBL_STATS'[SRC_TABLE_NAME] = CurrentFileName &&

        'DB_SRC SRC_TBL_STATS'[BUSINESS_UNIT] = CurrentBusinessUnit

    )

)

 

RETURN

IF (

    ISINSCOPE('DB_SRC SRC_TBL_STATS'[SRC_TABLE_NAME]),  -- Check if the current scope is at the table level

    IF (

        NOT (SrcTableCount > RawTableCount),

        1, -- Highlight the difference at the table level

        0 -- Do not highlight

    ),

    0 -- Do not highlight at the business unit level

)

 

Using this measure In my Power BI Desktop all the record count values are getting highlight, if the record counts are matching then to it is showing the highlight color. 

 

1 REPLY 1
v-weiyan1-msft
Community Support
Community Support

Hi @JyotiChiluka ,

 

Based on the sample and description you provided, you might consider creating a relationship between the two tables.

vweiyan1msft_0-1705477407823.png

Then please try code as below to create a Measure.

Measure = IF(SELECTEDVALUE(Source[Record Count]) > SELECTEDVALUE(Raw[Record Count]),1,0)

Result is as below.

vweiyan1msft_1-1705477465521.png

Is this the result you expect?
Please correct me if I misunderstood your needs.

 

Best Regards,
Yulia Yan

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

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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