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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
NBDOC
Frequent Visitor

CONDITIONAL FORMATTING WITH FIELD PARAMATERS IN MATRIX

I realize there no way to do conditioanl formatting on field parameters without DAX. Here is one of multiple measurs I have on a field paramater in Matrix table. Please help me add a simple color measure to turn the font or background green if var_b>var_a and red if the opposite, assuming I would be able to add it to the same measure box. If requires a separate measure please show me how and where to apply it on the Visualizations fields:

 
Billing % Var =
var _a = CALCULATE(SUM(Master[Orig Billing Amount]),FILTER(Master,Master[Service Dt].[Year]=max(Master[Service Dt].[Year])-1))
var _b = CALCULATE(SUM(Master[Orig Billing Amount]),FILTER(Master,Master[Service Dt].[Year]=max(Master[Service Dt].[Year])))
return
IF(ISINSCOPE(Master[Service Dt].[Year]),SUM(Master[Orig Billing Amount]),FORMAT(DIVIDE(_b-_a,_a),"Percent"))
 
 
Thank you in advance
1 ACCEPTED SOLUTION

Hi @NBDOC ,

If field parameters don't work for you, I would go old school. So basically, you create a table that has  the name of your measures and use a conditional formula to return the value of a measure depending on what of the value of the measure column from another table. In the image below, Measure in Columns  tile is from a column from __MEASURES table which doesn't have relationship Table. What binds them is Actual Budget Diff measure.

Actual Budget Diff = 
SWITCH (
    SELECTEDVALUE ( __MEASURES[Measure] ),
    "ACT", [ACT],
    "BUD", [BUD],
    "DIFF", [DIFF]
)

danextian_0-1710674301907.png

It is rather finnicky but should work in most cases. Please see attached pbix for details.

 










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


Proud to be a Super User!









"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

5 REPLIES 5
danextian
Super User
Super User

Hi @NBDOC ,

 

You can just modify your formula a bit.

Billing % Var Conditional Formatting =
VAR _a =
    CALCULATE (
        SUM ( Master[Orig Billing Amount] ),
        FILTER (
            Master,
            Master[Service Dt].[Year]
                = MAX ( Master[Service Dt].[Year] ) - 1
        )
    )
VAR _b =
    CALCULATE (
        SUM ( Master[Orig Billing Amount] ),
        FILTER ( Master, Master[Service Dt].[Year] = MAX ( Master[Service Dt].[Year] ) )
    )
RETURN
    IF ( _b > _a, "red" )
/*replace red with a different color or a hexadecimal code 
samples on this site  - https://htmlcolorcodes.com/colors/shades-of-red/ */

Select Field Value in the conditional formatting dialogue box and use this measure.










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


Proud to be a Super User!









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

tHello @danextian 

Two issues with that:

1- When selecting "Show Selected Fields", the first option "Do not Summarize" is absent on my screen. The selection defaults to "First" which would just show the name of the selected field accross the whole matrix table. As soon as I change it back to "Show Values of Selected Field", the values of that field comes back to the table but not the CF

2- The subtotal field which is calculated by the measure I posted earlier does not seem to change color no matter what. Is there a way to do that?

Thank you for taking the time and effort to help out 

Hi @NBDOC ,

If field parameters don't work for you, I would go old school. So basically, you create a table that has  the name of your measures and use a conditional formula to return the value of a measure depending on what of the value of the measure column from another table. In the image below, Measure in Columns  tile is from a column from __MEASURES table which doesn't have relationship Table. What binds them is Actual Budget Diff measure.

Actual Budget Diff = 
SWITCH (
    SELECTEDVALUE ( __MEASURES[Measure] ),
    "ACT", [ACT],
    "BUD", [BUD],
    "DIFF", [DIFF]
)

danextian_0-1710674301907.png

It is rather finnicky but should work in most cases. Please see attached pbix for details.

 










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


Proud to be a Super User!









"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 

This measure is part of a field parameter so conditional formatting option is not listed in the drop down list. . Where can I find the dialogue box you are referring to earlier?

Appreciate your help. 

Enable Show  selected field.

danextian_0-1710644826525.png

The option to conditionally format a parameter will appear after doing so.

danextian_1-1710644861307.png

 










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


Proud to be a Super User!









"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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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