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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
fpennisi17
Helper III
Helper III

Column totals for matrix with specific layout

Hi,

I have a matrix with no stepped layout, two row fields (part of a hierarchy), no column fields and multiple value fields.

So basically, except for the two row headers, all the table columns are values.

There are no subtotals.

 

I would like to add a footer row showing the total for some columns.

Is there a way to achieve that?

1 ACCEPTED SOLUTION

Hi, @fpennisi17 

 

Based on your description, I created data to reproduce your scenario.

Table:

a1.png

 

You may create measures as below.

 

Measure1 = 
IF(
    ISINSCOPE('Table'[Field]),
    SUM('Table'[Value1]),
    BLANK()
)
Measure2 = 
IF(
    ISINSCOPE('Table'[Field]),
    SUM('Table'[Value2]),
    IF(
        ISFILTERED('Table'[Level]),
        BLANK(),
        SUM('Table'[Value2])
    )
)
Measure3 = 
IF(
    ISINSCOPE('Table'[Field]),
    SUM('Table'[Value3]),
    BLANK()
)
Measure4 = 
IF(
    ISINSCOPE('Table'[Field]),
    SUM('Table'[Value4]),
    IF(
        ISFILTERED('Table'[Level]),
        BLANK(),
        SUM('Table'[Value4])
    )
)
Measure5 = 
IF(
    ISINSCOPE('Table'[Field]),
    SUM('Table'[Value5]),
    IF(
        ISFILTERED('Table'[Level]),
        BLANK(),
        SUM('Table'[Value5])
    )
)

 

 

Then you need to make the matrix selected, go to 'Visualizations' ribbon, click 'Format'=>'SubTotals', set 'Row subtotals' on.

a2.png

 

Result:

a3.png

 

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

8 REPLIES 8
amitchandak
Super User
Super User

@fpennisi17 , Not very clear. Matrix does how Grand Total. Can you explain with an example or screenshot

 

Also refer: https://www.burningsuit.co.uk/blog/2019/04/7-secrets-of-the-matrix-visual/

 

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Cattura.PNG

 

In this example I reproduced, in Excel, my matrix layout.

Hi, @fpennisi17 

 

Based on your description, I created data to reproduce your scenario.

Table:

a1.png

 

You may create measures as below.

 

Measure1 = 
IF(
    ISINSCOPE('Table'[Field]),
    SUM('Table'[Value1]),
    BLANK()
)
Measure2 = 
IF(
    ISINSCOPE('Table'[Field]),
    SUM('Table'[Value2]),
    IF(
        ISFILTERED('Table'[Level]),
        BLANK(),
        SUM('Table'[Value2])
    )
)
Measure3 = 
IF(
    ISINSCOPE('Table'[Field]),
    SUM('Table'[Value3]),
    BLANK()
)
Measure4 = 
IF(
    ISINSCOPE('Table'[Field]),
    SUM('Table'[Value4]),
    IF(
        ISFILTERED('Table'[Level]),
        BLANK(),
        SUM('Table'[Value4])
    )
)
Measure5 = 
IF(
    ISINSCOPE('Table'[Field]),
    SUM('Table'[Value5]),
    IF(
        ISFILTERED('Table'[Level]),
        BLANK(),
        SUM('Table'[Value5])
    )
)

 

 

Then you need to make the matrix selected, go to 'Visualizations' ribbon, click 'Format'=>'SubTotals', set 'Row subtotals' on.

a2.png

 

Result:

a3.png

 

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

It worked for the data.

I didn't want the intermediate subtotals, so I also unchecked them for first level of hierarchy, by enabling "per row level" option.

In this way, I had to apply the condition you suggest (if not in scope then blank) only in the measures for which I don't want the total.

 

By the way, one annoying thing remains. I don't know why, but albeit the totals take only the height of one row, the footer row is much higher (see screenshot)

 

Cattura.PNG

 

How can I eliminate that space?

Hi, @fpennisi17 

 

I wonder if you have set some other formats. You may try 'Revert to default' and then reset them. Here is my setting in 'Subtotals'.

c1.png

 

Result:

c2.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I understood the issue.

In my table there is a value column which is hidden, that I use for sorting.

I forgot to apply the condition on the scope on that column, so the subtotal of that column spanned taking that space.

I just need to apply that condition and everything worked like a charm.

 

Thank you very much!

HarryBailey
Helper II
Helper II

Hi there - are the values in your data source in PowerBI listed as values? I've had this before where they weren't totalling, had to change the type from text to whole number within PowerQuery.

I made a measure for all of them.

I've set the type for every measure. Some are numeric, some others are textual.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.