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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.

Top Solution Authors