Forum Discussion

derekli1700's avatar
derekli1700
Icon for Helper III rankHelper III
1 year ago
Solved

How to have both Subtotal AND Total Row in Matrix Table (whilst hiding some rows)

Hi - i currently have a table where i show all my store's YTD and PYTD sales and the YOY% change. Sales YTD = CALCULATE( SUM('Export'[Sales]), DATESYTD('DateTable'[Date]) ) Sales PYTD = C...
  • OwenAuger's avatar
    1 year ago

    Hi derekli1700 

    Here's the closest I could get to this visual appearance using a Matrix visual.

     

    Sample PBIX is attached.

     

    1. Add a Dummy table with a single column and single row, containing an arbitrary value. In my example it is a table with column Dummy[Dummy] with single value "Dummy".

    2. Create a Matrix visual with Dummy[Dummy] and Sales[Category] on rows, plus your measures in Values.

    3. Set the Layout Preset to Tabular.

    4. Turn off Wrap text in Column Headers and Row Headers.

    5. Turn off +/- buttons for Row Headers.

    6. Create a calculation group with a single calculation item with this expression:

    IF (
        ISINSCOPE ( Dummy[Dummy] ),
        SELECTEDMEASURE (),
        CALCULATE ( SELECTEDMEASURE(), REMOVEFILTERS ( Sales[Category] ) )
    )

    7. Apply this calculation item as a filter to the matrix.

    8. Reduce the width of the Dummy column so that it is invisible.

    9. Change the Row subtotal label for Category to "Subtotal":

     

    10. Filter Category as required.

     

    Is that the sort of thing you were looking for?