 What's going on everybody? Welcome back to the Power BI tutorial series. Today we're going to be taking a look at conditional formatting. Now conditional formatting may sound familiar because we looked at it in the Excel series and it's very similar how you use it in Excel versus how you use it in Power BI. Conditional formatting allows you to take a table or a matrix within Power BI and use those cells to color code them and create gradients and different visualizations within the actual table or matrix. I'm excited to start this one so let's jump over my screen and get started with the tutorial. All right so before we get started if you want to use the data that we're using in this video you can find it in the description on my GitHub. Now conditional formatting is super simple and you've most likely used it in Excel before but you can also use it in Power BI and let me show you how to do that. So the first thing we're going to do is come over to our apocalypse store and we're going to pull up our product name as well as the price. And what we can do is come over here and we're going to go to price and it has to be under the columns so you can't come over here and do this. We're going to come right over here to price and we're going to right click and let's go to conditional formatting and we have background color font color icons and web URL. Let's take a look at background color first this is most likely the one that we'll look at the most. So we're going to get this pop up and I'm going to slide this over. Now there's a lot of different things we can customize in here and the first thing I'm going to take a look at is format style. We have the gradient and what it's going to say is the lowest value will be this color highest value will be this color. They'll give us this gradient color scale. And so we'll use that in just a little bit but we can also create rules kind of like an if statement and if it is between this range and this range we'll give it a color and if it's between a different range and a different range we'll give it a different color. So we'll also try that one and then we have this field value and this one is one that honestly I don't use that much I've used it maybe once and what you can do is select a text field like customer and you can do some summarizations on the first and last and that is it. So what we're going to do is we're going to look at gradient specifically for not the customer but we're going to go back to the apocalypse store and we're going to do it on the price. Now what I'm going to do is keep it as the count because this is what the default is and we're going to go back and fix it later but what we want our lowest value to be is this bright green showing that this it's a cheap product it's easy to purchase the high value ones are going to be just the shade of red more expensive and we'll do it on the count now remember the count is on each of these and we're not doing a count of how many are sold we're doing a count of each product so it's just one per row so it all should be the same color let's take a look so it is all the same color but what we really want to show is the actual price not just the count of the price so let's go back to conditional formatting we're going to click the background color again and this time we're going to change the summarization now you can do some you can do average minimum maximum it really doesn't matter for this example the number is the same regardless of really which one we choose so we can just choose the minimum and it's going to choose the minimum of each row which is the price so we're just going to select minimum for this example we'll select okay and it should correct it accordingly which means the bright green is the lowest and it goes all the way up to the highest which is the red now let's go over here to apocalypse sales we'll add in the units sold and let's move that out a little bit and i'm doing that on purpose because we're about to look at something within the conditional formatting so let's go to unit sold and we'll look at the conditional formatting for this one now if you noticed we now have a new one on here called data bars now we're able to see data bars on unit sold and not price because unit sold is something like a sum an average something that's aggregated but let's take a look at data bars because i want to show you how to use this and then we'll go back to the background color so for data bars we are going to take a look at the lowest of the highest value again we're going to go from bright green all the way to this exact red it's going to be from left to right and what it's going to show you is if it is a positive number which all of these are is going to be a green bar basically representing the number that you see in here along this line so let's click okay and we're going to be able to see the highest numbers and let's scooch this over quite a bit so you can kind of get a better understanding and we're going to do it from highest to lowest so we sold the most multi-tool survival knives at 477 and so this entire bar this row is entirely filled up or almost all the way filled up while as it gets lower and as we sell only 182 solar battery flashlights the bar is going to represent that and show that now i'm about to completely mess up this visualization on purpose because it's about to get very messy to show you that you can do a little bit too much it is possible what we're going to do is we're going to go right over here to this background color unit sold and instead of gradient let's look at rules now with the price we just did a gradient scale but we can do basically groups of these and say if a number is greater or equal than this number then it's going to be a certain color and then if it's in a different range we can give it a different color so we're going to say if it's greater than or equal to zero and we're going to say number not percent and if it's less than 266 because you have 265 right here let's make it a nice like gold a beautiful lovely mustard gold just just great now we're going to say if it's greater than or equal to we'll do 266 because this says less than 266 so it should be greater than or equal to 266 number and if it is less than we'll say 500 now we want to do this one and we'll give it let's do like a peach and we'll click okay and now we have another conditional formatting on top of that that can give us more information now again you should not do this it's just too many now let's go one step further and make it even more ridiculous and show you one more thing before I show you how you may actually want to use this let's go back to unit sold we're going to right click go to conditional formatting and you can do something called icons font color is the exact same thing as background color except it changes the the font and so I'm not really going to look into that one icons are very simple extremely similar to excel and how you've seen them and the rules that you can apply to them are basically the same as if you're doing like a gradient and is these if statements that we saw before now it auto gives us this right here which basically says 0 to 33 33 to 67 67 to 100 if it's in the bottom third percent it gives us this red the middle is yellow and the top is green so we can go through and change all of this but honestly this looks pretty good so let's click on it and so the ones that are our lease sellers are these red ones right here and the top sellers are up here now this is just based on unit sold and this looks absolutely terrible so let's kind of take this exact information but make it a little bit better so we're going to create a new visualization or at least a new table so let's click on product name and we'll take the price unit sold and revenue and what I think makes the most sense for looking at revenue is these data bars right here but there's only one problem I can't do that because it's not summarized like unit sold was but what I can do is to get that those data bars because I can come right down here instead of saying don't summarize I can summarize it and I can just click the sum so it now is summarized it's the exact same number but if I right click on here as sum of revenue I go to conditional formatting I can now use those data bars and so we're going to use those data bars and we're going to say for the lowest value and the highest value and let's just make it a nice maybe a darker green I don't want it to wow that's that's hideous let's make it this color right here a nice dark green and there's no negative so it doesn't really matter we're gonna go left to right and you can show the bar only but we're gonna keep it because I want to see it and we're gonna go just like this we're gonna order and this is pretty telling honestly I did not think the weatherproof jackets were performing so well but I mean they are by far a number one seller so you know our weatherproof jackets multi-tool survival knives and the nylon rope are performing outperforming all of our other products so those might be the ones that I focus on the most while duct tape the n95 mask and waterproof matches I mean those are those are garbage so I might be looking to replace those in the near future with some other items that might sell a little bit better so that's how you use conditional formatting and it's actually pretty useful there are a lot of times where I've done something like this and an actual visualization for work and it looks something like this it just depends on what you're visualizing but this is very much a simple thing that you can do to just add a little bit more information and an actual visuals to this little chart or table that you're going to create sometimes it's just better to have these simple visualizations on this table rather than just having the numbers themselves makes it a little bit more easy to read and understand so again I hope that this was helpful thank you guys so much for watching I really appreciate it if you liked this video be sure to like and subscribe and check out all my other videos on Power BI and I'll see you in the next video