Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hello All,
What I want to Achieve:
I have a table where I consolidate all KPIs inputs from stakeholders to track their performance on monthly basis against set targets.
I am pretty comfortable with Power BI and producing visuals, applying custom color coding but for matrix table I am not getting the right formulas on how to enforce color coding measure on such data structure and how to enforce format per row as well since both ACT and TGT are on same column. I am specific about the visual use since its a management request 😀
I would apprciate your advise, direction and help in DAX if needed to be able to produce the desired output. Thanks all for your support in advance
Below is desired result I wish to achieve:
Same format applies to the rest of the months Feb-Dec
Facts about the Sample Data Table:
Sample Data Table
Solved! Go to Solution.
Hi , @sas5610
Thanks for your sample data first~
According to your description, you want to create a Matrix visual as your image.
Here are the steps you can refer to :
(1)My test data is the same as yours.
(2)We can create a sort column in Power Query to sort out [Type] Column:
(3)Then we can apply the data to desktop and we need to create two measures:
Measure = var _uon = MAX('Table'[UOM])
return
SWITCH(_uon,
"$/kg" , FORMAT(SUM('Table'[Value]) , "0.00"),
"%" , FORMAT(SUM('Table'[Value]) , "0%"),
"$k" , FORMAT(SUM('Table'[Value]) , "0.00"),
"PPM" , FORMAT(SUM('Table'[Value]) , "0"))
Color = var _type = MAX('Table'[Type])
var _derection=MAX('Table'[KPI Direction])
var _tgt = CALCULATE( SUM('Table'[Value]) , 'Table'[Type] = "TGT",ALLEXCEPT('Table','Table'[KPI],'Table'[UOM]))
return
IF(_type="ACT",IF(OR(_derection = "Increase" && SUM('Table'[Value]) > _tgt , _derection = "Decrease" && SUM('Table'[Value]) <= _tgt ) , "green" ,"red"))
(4)Then we can put the fields we need on the visual and we can configure some options we need , like this:
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
Thanks for your support Aniya, you saved me a lot of time. Exactly what I wanted and easy to follow solution!! I have a quesiton on the color measure for clarificationn only. Why do you used max function as variable and what it does produce as output?
Hi , @sas5610
Thanks for your sample data first~
According to your description, you want to create a Matrix visual as your image.
Here are the steps you can refer to :
(1)My test data is the same as yours.
(2)We can create a sort column in Power Query to sort out [Type] Column:
(3)Then we can apply the data to desktop and we need to create two measures:
Measure = var _uon = MAX('Table'[UOM])
return
SWITCH(_uon,
"$/kg" , FORMAT(SUM('Table'[Value]) , "0.00"),
"%" , FORMAT(SUM('Table'[Value]) , "0%"),
"$k" , FORMAT(SUM('Table'[Value]) , "0.00"),
"PPM" , FORMAT(SUM('Table'[Value]) , "0"))
Color = var _type = MAX('Table'[Type])
var _derection=MAX('Table'[KPI Direction])
var _tgt = CALCULATE( SUM('Table'[Value]) , 'Table'[Type] = "TGT",ALLEXCEPT('Table','Table'[KPI],'Table'[UOM]))
return
IF(_type="ACT",IF(OR(_derection = "Increase" && SUM('Table'[Value]) > _tgt , _derection = "Decrease" && SUM('Table'[Value]) <= _tgt ) , "green" ,"red"))
(4)Then we can put the fields we need on the visual and we can configure some options we need , like this:
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
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
118 | |
84 | |
48 | |
38 | |
28 |
User | Count |
---|---|
185 | |
73 | |
72 | |
48 | |
42 |