Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hello all,
We need to build a matrix/table in Power BI where each row/column represents a different specification/metric, and each requires a completely different calculation logic.
For example:
Additionally, in some cases, the calculation may also vary based on the column header context.
Hi @manvishah17 ,
another option could be a matrix with calculation groups as columns and rows. For every cell the combination of two calculation items is set:
Your calculation group definitions should look similar to this in model view:
Check in table view if ordinal numbers are assigned to the calculation items. If not change them by drag and drop:
Assuming that rows have precendence a typical row calculation group item would look like this:
Row 1 = "Row 1"
A typical column item definition would look like this:
Col 1 = 0
If you want to change the priority for column 2 and row 2, you need something like:
Col 2 = "Col 2"
and
The matrix of my little demo:
Hope that helps.
Hi ,
Try to Put your spec names in a disconnected table → use it as Matrix rows → one master measure checks which spec is selected and runs the right calculation.
1. Disconnected Spec Table:
Spec Table =
DATATABLE( "SpecID", INTEGER, "SpecName", STRING, { { 1, "Spec A" }, { 2, "Spec B" }, { 3, "Spec C" } } )
No relationship needed. Use SpecName on Matrix Rows.
2.Split into Bucket Measures (NOT one giant SWITCH)
_Bucket1 =
SWITCH(
SELECTEDVALUE( 'Spec Table'[SpecID] ),
1, [Weighted Avg Logic],
2, [SLA Logic], BLANK() )
_Bucket2 =
SWITCH(
SELECTEDVALUE( 'Spec Table'[SpecID] ),
3, [Cost/Revenue Logic],
4, [Custom Score Logic], BLANK() )
3.Master Measure (routes to the right bucket)
Master KPI =
VAR _id = SELECTEDVALUE( 'Spec Table'[SpecID] )
RETURN
SWITCH(
TRUE(),
_id <= 15, [_Bucket1],
_id <= 30, [_Bucket2],
_id <= 50, [_Bucket3] )
Only one bucket fires per row — this is what prevents performance issues.
Always follow the below steps:
Thanks and Regards,
GainInsights Solutions
Trusted Microsoft Partner - https://gain-insights.com/partnerships/microsoft/
www.gain-insights.com
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.
| User | Count |
|---|---|
| 48 | |
| 40 | |
| 40 | |
| 20 | |
| 16 |
| User | Count |
|---|---|
| 70 | |
| 67 | |
| 32 | |
| 27 | |
| 26 |