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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Atanas_Atanasov
Helper II
Helper II

Conditional Formatting Based On Multiple Crieria (sorry I searched, but couldn't find solution)

Dear community,

I have a simple table loaded in power BI which looks like that (screenshot 1)

Atanas_Atanasov_0-1770389061051.png

 

The metric column and the quarter columns are coming from a single table named "Quarterly Results" - Quarterly Results[metric] and Quarterly Results[Quarter].

The measure you are seeing is extremely simple: 

Volumes =
    SUM( 'Quarterly Volumes'[Value] )
When I put it in the values section of the matrix the metric and the quarters are slicing it.
Now, here's my problem. I must create color coding which colors in red the quarter where 
BF Surveyable Events > 7 and BF Surveys = 0.
As you can see, that would be FY25Q3 as marked here:
Atanas_Atanasov_1-1770389257196.png

I've tried multiple solutions and none of them worked. 

I also created 2 new measures:

BF Surveyable Events =
CALCULATE(
    [Volumes],
    KEEPFILTERS( 'Quarterly Volumes'[Metric] = "BF Surveyable Events" )
)
and 
BF Surveys =
CALCULATE(
    [Volumes],
    KEEPFILTERS( 'Quarterly Volumes'[Metric] = "BF Surveys" )
)
Then created a new measure which has the following syntax:
Check =
VAR calc_1 = [BF Surveyable Events]
VAR calc_2 = [BF Surveys]
RETURN
SWITCH(
    TRUE(),
    MIN( 'Quarterly Volumes'[Metric] ) = "BF Surveyable Events" &&
    calc_1 > 7 &&
    calc_2 = 0,
    1,
    0
)
Thinking to use it as a rule in my conditional formatting. So when it equals 1 to be red, otherwise black.
Atanas_Atanasov_2-1770389532685.png

But what it does its returning 1 to all values for BF Surveyable Events like here:

Atanas_Atanasov_3-1770389602202.png

And respectively, it colors my whole line in red. While I'd expect it to color only FY25Q3.

Can anyone help me with that please? 

All due respect,

Atanas

1 ACCEPTED SOLUTION
Praful_Potphode
Super User
Super User

Hi @Atanas_Atanasov ,

You can use Visual Calculation(Select Your Visual and click on New Visual Calculation) to achieve the result shown below:

Praful_Potphode_0-1770460316568.pngPraful_Potphode_1-1770460355584.png

PFA PBIX.

Please give Kudos or mark it as solution once confirmed.

 

Thanks and Regards,

Praful

 

View solution in original post

5 REPLIES 5
Atanas_Atanasov
Helper II
Helper II

@divyed and @Praful_Potphode - also I was able to do it with DAX today... there was sorting happening in the table. The metrics column was sorted by another column, so the order appears the same every time. So, basically:
CALCULATE(
    [Volumes],
    REMOVEFILTERS( Quarterly Volumes[Order] ),
    Quartertly Volumes[Metric] = "BF Surveyable Events"
) works like a charm now... I know it is a trivial problem, but really was not aware of it.
Biggest takeaway is if your DAX is not working as it should be always check that... mainly in calendar tables. 
Thank you both,
Atanas

divyed
Super User
Super User

Hello @Atanas_Atanasov ,

 

Visual calculation is definately an option here but you can also modify your dax to do the same. I can see issue in your dax which has potential conatext issue. I would suggest to use selectedvalue function to get current values and that will work. You can share sample raw data if you want full dax.

 

I hope this helps.

 

Cheers.

 

Did I answer your query, Mark this as solution if this helps, kudos are appreciated.

 

Cheers

Neeraj Kumar

 

LinkedIn : https://www.linkedin.com/in/neeraj-kumar-62246b26/

@divyed - thank you for the suggestion! As @Praful_Potphode suggested I used visual calculation. I also resolved it with DAX and disconnected table. I think something might not be right with the report in general as I inherited it from another developer. Thank you one more time and wish you all the best,

Atanas

Praful_Potphode
Super User
Super User

Hi @Atanas_Atanasov ,

You can use Visual Calculation(Select Your Visual and click on New Visual Calculation) to achieve the result shown below:

Praful_Potphode_0-1770460316568.pngPraful_Potphode_1-1770460355584.png

PFA PBIX.

Please give Kudos or mark it as solution once confirmed.

 

Thanks and Regards,

Praful

 

@Praful_Potphode - Thank you so much! That resolved my issue. I have also accomplished the coloring with disconnected table where i just put the values of the metric column. Then dragged it into the matrix and applied the same code:

if( metric name = "BF Surveyable Events" && [BF Surveyable Events] > 7 && [BF Surveys] = 0, 1, 0 )
But this works only with disconnected table. However, your solution is simpler and more elegant. Thank you one more time. 

Helpful resources

Announcements
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.

March Power BI Update Carousel

Power BI Community Update - March 2026

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