Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
vpe27
New Member

Group DAX measures in matrix by Category and Subcategory

Hi,

 

Need your help, how to group DAX measures in matrix visual by non existing category and subcategory. I read probably all the similar posts in the forums, and try some things, unfortunately no success.

 

Situation:

1. I have simple model, only one FactTable and one dimDate:

vpe27_0-1683478311208.png

2. Data in FactTable like below:

IDDateAmount
CU8202023-01-0121,27
CU8202023-01-0221,27
CU8202023-01-3121,38
CU8202023-02-0521,41
CU8202023-02-1721,33
CU8202023-02-2821,27
CU8202023-03-0121,28
CU8202023-03-1521,77
CU8202023-03-2721,27
50CQ92023-01-01304,33
50CQ92023-01-10303,99
50CQ92023-01-31303,87
50CQ92023-02-05304,01
50CQ92023-02-17304,09
50CQ92023-02-28304,09
50CQ92023-03-01303,87
50CQ92023-03-15304,09
50CQ92023-03-27303,99
40CQ92023-01-0145,66
40CQ92023-01-1044,34
40CQ92023-01-3145,76
40CQ92023-02-0545,66
40CQ92023-02-1745,76
40CQ92023-02-2844,34
40CQ92023-03-0145,76
40CQ92023-03-1545,66
40CQ92023-03-2745,76
20CQ92023-01-01132,29
20CQ92023-01-02133,01
20CQ92023-01-31132,87
20CQ92023-02-05132,29
20CQ92023-02-17133,01
20CQ92023-02-28132,87
20CQ92023-03-01132,29
20CQ92023-03-15132,87
20CQ92023-03-27132,87
CE3012023-01-0168,44
CE3012023-01-0268,67
CE3012023-01-1065,44
CE3012023-02-0568,67
CE3012023-02-1765,44
CE3012023-02-2868,44
CE3012023-03-0168,67
CE3012023-03-1565,44
CE3012023-03-2765,44
1XQ902023-01-012099,11
1XQ902023-01-022100,22
1XQ902023-01-312099,11
1XQ902023-02-052099,11
1XQ902023-02-172103,44
1XQ902023-02-282100,22
1XQ902023-03-012103,44
1XQ902023-03-152100,22
1XQ902023-03-272103,44
CQ9112023-01-01500,99
CQ9112023-01-02501,56
CQ9112023-01-31501,44
CQ9112023-02-05501,56
CQ9112023-02-17500,99
CQ9112023-02-28502,01
CQ9112023-03-01501,56
CQ9112023-03-15502,01
CQ9112023-03-27500,99

 

3. Prepared few simple DAX measures of these ID's, ex. AVERAGEX, SUMX, CALCULATE, etc.

4. Visualized in Matrix these DAX measures as Rows and Year&Month as Columns.

 

Task:

Additionally I need to group measure rows by Category and Subcategory, and matrix should look like this:

vpe27_0-1683480411535.png

 

Please note:

1. Category and Subcategory doesn't exist in any table.

2. Some Categories can have few Subcategories.

3. Some IDs from FactTable on which Measures are made may belong to multiple Categories or Subcategories.

4. Nead possibility of +/- by Category and Subcategory.

 

Thanks in advance,

vpe27

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

If Categories and Sub categories are not present in any Table, then how do you propose to show those columns/fields in your visual????


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hello,

Yes, you are right 🙂 But this factor also important.

I can create separate table with Categories and Subcategories, like this example:

 

DynamicMeasuresTable = DATATABLE(
"Measure", STRING,
"Sort Order", INTEGER,
"Category", STRING,
"Subcategory", STRING,
{
{"Device CU820 Working Days", 1, "Load", ""},
{"Device CU820 Average load, %", 2, "Load", ""},
{"Device 50CQ9 Heat", 4, "Heat and Electricity", "Heat"},
{"Device 40CQ9 Heat", 5, "Heat and Electricity", "Heat"}

/* Other Measures with Categories and Subcategories -> {...}
}
)

 

Then create Dynamic Measure to map Categories / Subcategories with real Measures:

DynamicMeasure =
VAR selection = SELECTEDVALUE(DynamicMeasures[Measure])
RETURN
SWITCH(
selection,
"Device CU820 Working Days", [010_DeviceCU820WorkingDays],
"Device CU820 Average load", [020_DeviceCU820AverageLoad],
"Device 50CQ9 Heat", [040_Device50CQ9Heat],
"Device 40CQ9 Hea", [050_Device40CQ9Heat],

/* Other Measures with Categories/Subcategories map
BLANK()
)

 

But here is the problem, how to relate with main FactTable and dimDate?

 

Another solution instead this one is do everything with Tabular Editor, create Dynamic Measures. Bus still, I face same issue.

 

 

Regards,

vpe27

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.