Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Hi,
I need to create a rule for example:
if sum(Sales)>value_1, red,
if value_2<sum(Sales)<value_1, green
if sum(Sales)<value_2, yellow
and I need to creare these value_1, value_2 dynamic ( I need to choose them)
how can I do?
Thank you
Giada
Solved! Go to Solution.
@Giada_Togliatti , Value_1, and Value_2 can be whatif measure
https://docs.microsoft.com/en-us/power-bi/desktop-what-if
And you can create a color measure and use option and field and use the measure in conditional formatting
measure= Switch( true(),
sum(Sales)>selectedvalue(value_1[value_1]), "red",
sum(Sales)>selectedvalue(value_[value_2]) && sum(Sales)<selectedvalue(value_1[value_1]), "green",
sum(Sales)>selectedvalue(value_[value_2]), "yellow",
"blue")
https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting#color-by-color-values
Hi @Giada_Togliatti ,
You can create a measure using following DAX as follows: (Modify it based on the columns and measures you want to use)
Hi @Giada_Togliatti ,
You can create a measure using following DAX as follows: (Modify it based on the columns and measures you want to use)
@Giada_Togliatti , Value_1, and Value_2 can be whatif measure
https://docs.microsoft.com/en-us/power-bi/desktop-what-if
And you can create a color measure and use option and field and use the measure in conditional formatting
measure= Switch( true(),
sum(Sales)>selectedvalue(value_1[value_1]), "red",
sum(Sales)>selectedvalue(value_[value_2]) && sum(Sales)<selectedvalue(value_1[value_1]), "green",
sum(Sales)>selectedvalue(value_[value_2]), "yellow",
"blue")
https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting#color-by-color-values
it works, thank you!
Read my blog for how to write the DAX. https://exceleratorbi.com.au/conditional-formatting-with-a-text-field-in-power-bi/
for the selection, you need a What If Parameter
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
87 | |
81 | |
53 | |
37 | |
35 |