This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreDid you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. 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 ,
I would take a moment to thank @Hans-Georg_Puls for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference.
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions.
Thank you.
Hey,
I looked at the solutions provided but I have a query regarding Calcualtion group like I don't have any similar based measure, so how it will work.
Moreover other Switch case approach, I am aligned with using Int but creating Buckets, still have query how the exceution engine works.
Hi @manvishah17 ,
For calculation groups, it’s key to note that they do not require a shared or base measure. The measure you add to the Values well acts as a trigger, and when the visual is evaluated, the engine substitutes each calculation item’s logic in place of the measure. This allows each row to have independent logic, even across different tables. SELECTEDMEASURE becomes relevant only when you need calculation groups to interact, such as passing logic between rows and columns. If that’s not required, each calculation item can remain self-contained, and you can disregard SELECTEDMEASURE.
Regarding the SWITCH and bucket method, your concern about execution is well-founded. While SWITCH appears to evaluate just one branch, the DAX engine doesn’t always short-circuit as traditional languages do. With many branches, especially across different tables, the engine may evaluate more logic than expected, leading to higher memory usage and possible resource errors.
By splitting logic into buckets, you help the engine focus on a smaller group of calculations, reducing the dependency tree and storage engine queries. Storing the selected specification in a variable further optimizes performance by avoiding repeated filter context evaluations.
Both approaches are valid and serve different needs. Calculation groups offer flexibility for scenarios requiring interaction between rows and columns in a visual. The bucketed measure approach is generally easier to manage and performs well if each bucket is kept to a reasonable size. If your column logic is relatively static, the bucketed approach is often more straightforward.
Thank you.
Hi @manvishah17 ,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions.
Thank you.
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
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 34 | |
| 31 | |
| 25 | |
| 20 | |
| 16 |
| User | Count |
|---|---|
| 60 | |
| 48 | |
| 29 | |
| 23 | |
| 23 |