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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
patrick1192
Frequent Visitor

conditionaly formating with second value

Hi all,

 

I'm currently having problems implementing a use case.
I want to perform conditionally formatting on a table.

 

If the "failed" value for a main element is "1",

all subelements with the same PhysicalID should be conditionally formatted green (regardless of the "failed" entry of the subelements)

In the example,  the following lines should be (green) formatted:

 

2024-04-04_11h00_47.pngIn the productive case, several main elements can have the "failed" value 1.
Furthermore, the data is in the productive PBI via DirectQuery from Kusto.

 

I have tried a few things with measures, but unfortunaly i don´t get a solution so far.

 

Hopefully i have made myself clear, so that you can understand what my problem is.

Thanks for your help!

 

 

1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @patrick1192 

 

I'm not sure if this will work in direct query but try:

IF (
    CALCULATE (
        MIN ( data[failed] ),
        FILTER ( ALLEXCEPT ( data, data[physicalid] ), data[model] = "main-element" )
    ) = 1,
    "color"
)

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

3 REPLIES 3
danextian
Super User
Super User

Hi @patrick1192 

 

I'm not sure if this will work in direct query but try:

IF (
    CALCULATE (
        MIN ( data[failed] ),
        FILTER ( ALLEXCEPT ( data, data[physicalid] ), data[model] = "main-element" )
    ) = 1,
    "color"
)

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Hi @danextian ,

 

your code is working with a table visual (even with directquery!) Perfect!

 

When i use a matrix visual, the code is only working when i take the phsyicalID in a column.

Is there any chance to get this code working in a matrix when the physicalID is also a value ?

 

2024-04-04_15h23_01.png

 

 

Thanks for your Help!

The measure is evaluated for each cell in the matrix, depending on the row and column headers. Not using the physicaID as a row or column dimension will return an unexpected result. Try using that formul as a calculated column instead. If it is not supported in DQ, your other option is to create such in column in the source itself.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.

Top Solution Authors
Top Kudoed Authors