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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
BotBot1
Helper III
Helper III

Dynamic conditional formatting based on person selection

Hi,

I have a table summarising the value of opportunities secured by a sales team per quarter, the columns are as follows:

 

Quarter: A DateGlobalFilter table with a [Quarter] variable.

SumActualValue: A measure of won opportunity values.

Role Goal (Quarterly): A measure with HASONEVALUE and SWITCH, where if all team selected (slicer), £15m/quarter, and if a person's selected its changed to individual goals.

BotBot1_0-1675937447741.png

 

I am looking to have conditional formatting within the SumActualValue column so that the background colour spans from red to green depending on how close they are to the goal, but I am struggling with the DAX as I need the colouring to change dependant on the goal if changed.

(E.g. Q3 From my picture - Would be an orange colour [as about 30% of goal of £15m], but if I select a person with a quarterly goal of £2m and they secured £2.5m, I need this to change to green. So not comparing to the team goal of £15m.)

Here is my attempt at DAX which hopefully VAR only needs changing (can change colour descriptions to numbers and do rules in cond. formatting):

 

SecuredOpportunityValueColour = 
VAR
QOppValue = // not sure for this. Variable for team selection/names is 'TeamUsers'[PersonName]. 
RETURN
IF(
    HASONEVALUE(TeamUsers[PersonName]),
        SWITCH(
    TRUE(), 
    QOppValue < ([Role Goal (Quarterly)])/4, "Red",
    (AND(QOppValue < ([Role Goal (Quarterly)])/2, QOppValue >= ([Role Goal (Quarterly)])/4)), "Orange",
    (AND(QOppValue < ([Role Goal (Quarterly)])/(4/3), QOppValue >= ([Role Goal (Quarterly)])/2)), "Yellow",
    QOppValue >= ([Role Goal (Quarterly)])/(4/3), "Green"), 
        "Grey")

 

Thank you.

 

1 ACCEPTED SOLUTION
v-yueyunzh-msft
Community Support
Community Support

Hi , @BotBot1 

According to your description, you want to get the [QOppValue ] value.

And the [QOppValue ] value seems to get from the [Role Goal (Quarterly)]?

If this , you just need to make the [Role Goal (Quarterly)] return right in your logic in the visual .

And then you can use the [Role Goal (Quarterly)]  in your 'QOppValue' parameter.

var QOppValue= [Role Goal (Quarterly)]

 

If i got missing in your need , can you provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

View solution in original post

2 REPLIES 2
v-yueyunzh-msft
Community Support
Community Support

Hi , @BotBot1 

According to your description, you want to get the [QOppValue ] value.

And the [QOppValue ] value seems to get from the [Role Goal (Quarterly)]?

If this , you just need to make the [Role Goal (Quarterly)] return right in your logic in the visual .

And then you can use the [Role Goal (Quarterly)]  in your 'QOppValue' parameter.

var QOppValue= [Role Goal (Quarterly)]

 

If i got missing in your need , can you provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

Hi @v-yueyunzh-msft,

 

Thank you for this.

I managed to create a seperate measure creating a percentage of opportunity value to individual  quarterly goals and did conditional formatting rules based off this measure. Thanks for your help.

 

Kind regards,

 

@BotBot1 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.