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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
sumitnegi1266
Frequent Visitor

How to show Grand Total of a specific Row in Matrix

Hi Experts,

 

My data looks like below:

sumitnegi1266_1-1697625053306.png

 

What I need to achieve -> If the number of sets in data are more than 1, then I need to add one more row at the bottom of matrix for Weighted Average of Set. If there is only 1 set, then I don't want to show any row for Weighted Average of Set.

Currently, I am able to show Weighted average for every set, but I need to show it once at the bottom of matrix.

 

Weighted Average of Set = MIN( Weight(Set) ) * AVERAGE ( 'Table'[Amount] )

 

As shown below the Weighted Average of Set should be total of Weighted average of both sets i.e. 122 and show once at the bottom.

 

sumitnegi1266_3-1697625514590.png

 

Also, I have attached the PBIX file for above at below one drive location:

Power BI File Share

 

Any help is really appreaciated, many thanks in advance!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @sumitnegi1266 

You can create the following solution.

1.Create a calcaulated table

Table 2 = var a=SUMMARIZE(FILTER(DimCompany,[Company]<>"Weighted Average of Set"),[Set],[Rank],DimCompany[Company])
var b=ADDCOLUMNS({MAXX(ALLSELECTED(DimCompany),[Set])+1},"Rank",0,"Company","Weighted Average of Set")
return UNION(a,b)

2.Then create a measure

Measure =
VAR a =
    SUMMARIZE (
        FILTER ( ALLSELECTED ( DimCompany ), [Company] = "Weighted Average of Set" ),
        [Set],
        "Sales", [Sales]
    )
RETURN
    IF (
        SELECTEDVALUE ( 'Table 2'[Set] ) <> MAXX ( ALL ( 'Table 2' ), [Set] ),
        CALCULATE (
            [Sales],
            FILTER (
                DimCompany,
                [Set]
                    IN VALUES ( 'Table 2'[Set] )
                        && [Rank]
                            IN VALUES ( 'Table 2'[Rank] )
                                && [Company] IN VALUES ( 'Table 2'[Company] )
            )
        ),
        SUMX ( a, [Sales] )
    )

Then put the field of new table and measure to the matrix visual

vxinruzhumsft_0-1697780903381.png

 

Output

vxinruzhumsft_2-1697780992432.png

 

Best Regards!

Yolo Zhu

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

4 REPLIES 4
Ahmedx
Super User
Super User
Anonymous
Not applicable

Hi

Hi @Anonymous 

Anonymous
Not applicable

Hi @sumitnegi1266 

You can create the following solution.

1.Create a calcaulated table

Table 2 = var a=SUMMARIZE(FILTER(DimCompany,[Company]<>"Weighted Average of Set"),[Set],[Rank],DimCompany[Company])
var b=ADDCOLUMNS({MAXX(ALLSELECTED(DimCompany),[Set])+1},"Rank",0,"Company","Weighted Average of Set")
return UNION(a,b)

2.Then create a measure

Measure =
VAR a =
    SUMMARIZE (
        FILTER ( ALLSELECTED ( DimCompany ), [Company] = "Weighted Average of Set" ),
        [Set],
        "Sales", [Sales]
    )
RETURN
    IF (
        SELECTEDVALUE ( 'Table 2'[Set] ) <> MAXX ( ALL ( 'Table 2' ), [Set] ),
        CALCULATE (
            [Sales],
            FILTER (
                DimCompany,
                [Set]
                    IN VALUES ( 'Table 2'[Set] )
                        && [Rank]
                            IN VALUES ( 'Table 2'[Rank] )
                                && [Company] IN VALUES ( 'Table 2'[Company] )
            )
        ),
        SUMX ( a, [Sales] )
    )

Then put the field of new table and measure to the matrix visual

vxinruzhumsft_0-1697780903381.png

 

Output

vxinruzhumsft_2-1697780992432.png

 

Best Regards!

Yolo Zhu

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

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors