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
Defenestrator
New Member

How to use expanded matrix to generate dax query that shows correct measure values for hierarchy

I have three tables: Equipment, RBI Components, and TMLs.  There is a one-to-many relationship between equipment table and RBI components table.  There is a one-to-many relationship between equipment table and TML table.  But there is no relationship between RBI Components table and TMLs Table.  There are some equipment IDs with no corresponding component IDs.

 

I am trying to generate a dax query that shows Equpment ID in column 1, Component ID in Column 2, and Count of TMLs in column 3.  I want the dax query output to show the count of TMLs assocaited with the equipment ID in each row, even for equipment that have no components, and the value should be the count of TMLs for that equipment.   For equipment that have components, I would like to see only one row per component, also with the count of TMLs for that equipment.  I'd like to generate the dax query by copying it from matrix via performance analyzer, and not by hardcoding the dax query. 

 

The closest I've been able to get to desired behavior is with following measure formula and with row subtotals turned on, except that the resulting dax query has a bunch of extra rows that I don't want: it gives me subtotal even for equipment with components, whereas I want subtotal only for equipment without components.

 

Test Measure = IF(NOT(ISINSCOPE('RBI Components'[Component Description])),COUNT(TMLs[ENTY_KEY]),CALCULATE(COUNT(TMLs[ENTY_KEY]),CROSSFILTER('RBI Components'[MIV_MIR_HSRBICMP.PRED_ENTY_KEY],Equipment[ENTY_KEY],BOTH)))

Defenestrator_0-1724449539797.png

Note: 0124 1010-C has TMLs but no components. 

Resulting Dax Query Output:

Defenestrator_0-1724450512511.png

 

 

 

Other measures that I have tried have caused all the components to appear for every piece of equipment in the matrix.

 

This seems like it should be simple, but I keep on hitting a brick wall on this.  Grateful for any ideas or solutions.

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

it gives me subtotal even for equipment with components, whereas I want subtotal only for equipment without components.

Have the measure explicitly return BLANK() for rows you want to suppress.

View solution in original post

1 REPLY 1
lbendlin
Super User
Super User

it gives me subtotal even for equipment with components, whereas I want subtotal only for equipment without components.

Have the measure explicitly return BLANK() for rows you want to suppress.

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

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.