The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredAsk the Fabric Databases & App Development teams anything! Live on Reddit on August 26th. Learn more.
✅ Why this blog?
As of now, I couldn’t find a solid blog or solution that clearly addresses how to show total values when nothing is selected from a Matrix Table .Since this is a frequent question in the Power BI community, I decided to write this step-by-step guide to help others looking for the same solution.
Step 1: Create a new support Table
Table B =
UNION(
DISTINCT(SELECTCOLUMNS('Table A', "Product", 'Table A'[Product])),
ROW("Product", "All")
)
Step 2: Create Relationship
Go to Model view and create a relationship:
✅ Make sure this relationship is active.
Step 3: Create Measures
1️⃣ Sales Measure (Total or Filtered)
This measure checks the selected product. If "All" is selected, it returns total sales. If a specific product is selected, it filters accordingly.
Sales Measure =
VAR CurrentProduct = SELECTEDVALUE('Table B'[Product])
RETURN
IF(
CurrentProduct = "All",
CALCULATE(
SUM('Table A'[Sales]),
ALLEXCEPT('Table A', 'Table A'[Region])
),
CALCULATE(
SUM('Table A'[Sales]),
'Table A'[Product] = CurrentProduct
)
)
Selection Flag (For Visual Filter)
This measure ensures the correct rows appear in your visuals:
Selection Flag product =
IF(
ISFILTERED('Table A'[Product]),
IF(
SELECTEDVALUE('Table B'[Product]) = SELECTEDVALUE('Table A'[Product]),
1,
0
),
IF(
SELECTEDVALUE('Table B'[Product]) = "All",
1,
0
)
)
Step 4: Create the Stacked Bar Chart
🔎 Step 5: Apply Visual-Level Filter
To make sure only the selected product (or total) is shown:
🛠 Edit Interactions
✅ Result
Nothing Selected
Values selected
I have attached the sample Pbix file for your reference
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.