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

Ask the Fabric Databases & App Development teams anything! Live on Reddit on August 26th. Learn more.

kushanNa

Show Total When Nothing is Selected in Matrix Table

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:

  • From: Table A[Product]
  • To: Table B[Product]
  • Cardinality: Many to one (Table A → Table B)

Make sure this relationship is active.

 

kushanNa_0-1754238821069.png

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

  1. Insert a stacked bar chart
  2. Create a Matrix table with Table A Columns Product, Region, Sales  
  3. Set up the fields:
    • Y-axis → 'Table B'[Product]
    • X-axis (Values) → Sales Measure
    • Legend → 'Table A'[Region]

 

🔎 Step 5: Apply Visual-Level Filter

To make sure only the selected product (or total) is shown:

  1. Select the chart.
  2. Drag the Selection Flag product measure to the Visual-level filters pane.
  3. Set the filter to "is 1".

 

🛠 Edit Interactions

 

  1. Select the Matrix table.
  2. Go to Format > Edit Interactions
  3. For each visual:
    • Choose Filter () to apply slicer

kushanNa_1-1754239212208.png

Result

  • Selecting nothing → chart shows total sales for all products, split by region.

 

Nothing Selected

kushanNa_1-1754239625033.png

 

Values selected 

kushanNa_0-1754239608260.png

 

 

I have attached the sample Pbix file for your reference

Comments