cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Eddlugonz
New Member

Conditional Formatting - Two Variables or more

Greetings to all, I hope you will be all right!

I would currently like to know if it is possible to conditionally format two or more values in a single array.

My example case is as follows: I have a product in different stores and I know which ones it has been sold in(1), it is sold out(2) and it is not sold(3).

Understanding that the product can be sold and sold out in a set time, when establishing the matrix by store and product, can I reflect the two possibilities of the product of the same store under a conditional format?

I hope the example is clear and you can support me.

Greetings and thanks!

1 ACCEPTED SOLUTION
pranit828
Community Champion
Community Champion

HI @Eddlugonz 

Hope you mean in a sinle array is a single column.

Create a measure as

sold_stat = SWITCH(true(),

                   [col1] = "Sold",1,

                   [col1] = "Sold out",1,

                   [col1] = "Not Sold",1,0)

You change chage your conditions as per your requirement. this is what I could make out of it.

Then in the table or matrix go to formatting and Conditional formatting.

pranit828_0-1600469070469.png

pranit828_1-1600469107416.png

Select sold_stat and apply the format.

pranit828_2-1600469162962.png

 





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Eddlugonz , Usually for the complex case I prefer the "Field value" Option in conditional formatting and use a measure with that.

With the current description, I am not able to suggest a measure. But refer to these examples.

 

Color Year = if(FIRSTNONBLANK('Table'[Year],2014) <=2016,"lightgreen",if(FIRSTNONBLANK('Table'[Year],2014)>2018,"red","yellow"))

Color  = if(FIRSTNONBLANK('Table'[Year],2014) <=2016 && AVERAGE(Sales[Sales Amount])<170 
,"lightgreen",if(FIRSTNONBLANK('Table'[Year],2014)>2018,"red","yellow"))
Color sales = if([Sales Today] -[sales yesterday]>0,"green","red")

 

You can use meausres and dimesnions values with max/min/firstnonblank/lastnonblank etc.

 

Refer how to use here

https://radacad.com/dax-and-conditional-formatting-better-together-find-the-biggest-and-smallest-num...
https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting#color-by-color-values

 

In case you think this what can help you, see how the row context play a role in conditional formatting: https://youtu.be/Q1vPWmfI25o?t=2770



New Power BI Features
Datamarts: https://youtu.be/8tskWsJTEpg
Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin !! Proud to be a Super User!
Want To Learn Power BI
Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
!! Subscribe to my youtube Channel !!
pranit828
Community Champion
Community Champion

HI @Eddlugonz 

Hope you mean in a sinle array is a single column.

Create a measure as

sold_stat = SWITCH(true(),

                   [col1] = "Sold",1,

                   [col1] = "Sold out",1,

                   [col1] = "Not Sold",1,0)

You change chage your conditions as per your requirement. this is what I could make out of it.

Then in the table or matrix go to formatting and Conditional formatting.

pranit828_0-1600469070469.png

pranit828_1-1600469107416.png

Select sold_stat and apply the format.

pranit828_2-1600469162962.png

 





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile

Helpful resources

Announcements
June 2022 update 768X460.jpg

Check it out!

Click here to read more about the June 2022 updates!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors
Top Kudoed Authors