Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hi,
I used a daily sales dataset to display a matrix of the summed quarterly sales by Item.
Year | 2017 | 2017 | 2017 | 2017 | 2017 | 2018 | 2018 | 2018 | 2018 | 2018 |
Qtr | Q1 | Q2 | Q3 | Q4 | Total | Q1 | Q2 | Q3 | Q4 | Total |
Itm1 | 10 | 20 | 30 | 40 | 100 | 80 | 10 | 10 | 20 | 120 |
Itm2 | 40 | 30 | 20 | 10 | 100 | 20 | 10 | 10 | 80 | 120 |
This goes all the way out to Q1 2022, but for the sake of my explanation lets pretent its just 2 years.
I'm looking for a way to highlight the specific quarter that had the highest sale, for each item (i.e. for each row of the matrix). So for Itm1, the cell for Q1 2018 would highlight. Similarly for Itm2, the cell for Q4 2018 would highlight.
I know the long way to go about it in Power Query, by duplicating tables and making helper columns, and then using Group By and Max. I did implement this, but it really bogged down my refresh and isn't dynamic - i.e. the conditional formatting is unresponsive to me filtering out years. For example, I'd like to be able to filter out 2018 and now Itm1 has Q4 2017 as its max while Itm2 has Q1 2017 as its max.
I'm pretty sure what I'm asking about can be accomplished with some sort of combination of measures and conditional formatting based of those measures, but I'm stuck. I'm not great with using the CALCULATE function but I know this will likely be included.
Solved! Go to Solution.
@bend1234567 , Create a measure like this and use in conditional formatting using field value option
Measure =
Var _max = alculate(maxx(values(Table[Qtr]),[Sales]) filter(allselected(Table), Table[Item] = max(Table[Item]))
return
if([sales] =_max, "Green", "White")
How to do conditional formatting by measure and apply it on pie?
https://www.youtube.com/watch?v=RqBb5eBf_I4&list=PLPaNVDMhUXGYo50Ajmr4SgSV9HIQLxc8L
https://community.powerbi.com/t5/Community-Blog/Power-BI-Conditional-formatting-the-Pie-Visual/ba-p/...
You're amazing. Thanks so much!
@bend1234567 , Create a measure like this and use in conditional formatting using field value option
Measure =
Var _max = alculate(maxx(values(Table[Qtr]),[Sales]) filter(allselected(Table), Table[Item] = max(Table[Item]))
return
if([sales] =_max, "Green", "White")
How to do conditional formatting by measure and apply it on pie?
https://www.youtube.com/watch?v=RqBb5eBf_I4&list=PLPaNVDMhUXGYo50Ajmr4SgSV9HIQLxc8L
https://community.powerbi.com/t5/Community-Blog/Power-BI-Conditional-formatting-the-Pie-Visual/ba-p/...
User | Count |
---|---|
140 | |
113 | |
104 | |
77 | |
65 |
User | Count |
---|---|
136 | |
118 | |
101 | |
71 | |
61 |