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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
luxpbi
Helper V
Helper V

Problem with total row in matrix

Hi all, 

 

I have a Data that looks similar to this:

TypeAmountNumberAverage Price
A          1.000                  10                     100  
B          2.000                  10                     200  
C          3.000                  40                       75  
Total          6.000                  48                     125  

 

Amount is just a SUM. 

Average Price y just an Average.

Number is

DIVIDE(AMOUNT;AVERAGE PRICE;BLANK())

Like I wanted the total row Number represent the sum of the rows A, B and C and not the Division of Amount and Average Price, I did this: 

Number = IF(
    HASONEFILTER([Type]) ; DIVIDE([Amount] ; [Average Price] ; BLANK()) ; 
    SUMX (
            SUMMARIZE (
                VALUES ( [Type] );
                [Type];
                "AB"; DIVIDE ( [Amount]; [AVGPrice]; BLANK () )
            );
            [AB]
        ) 

And it works for that table. 

 

But the problem is when I want to represent the same data and measures but with a different dimension. 

Imagin that now I want to see it instead of by type, by Country, like this:

Country
Z
X
Y
Total


The measure won't work because just works in case that type is filtered ...

Any ideas to solve the problem that will work with all the dimensions of my model?

Thank you in advance!!

4 REPLIES 4
Zubair_Muhammad
Community Champion
Community Champion

@luxpbi

 

Give this a shot

 

Number =
IF (
    HASONEFILTER ( [Type] ),
    DIVIDE ( [Amount], [Average Price], BLANK () ),
    SUMX (
        ALLSELECTED ( TABLENAME ),
        DIVIDE ( [Amount], [Average Price], BLANK () )
    )
)

@Zubair_Muhammad thanks for your answer but it doesn't work even with the [Type] table visual.

And I think that your formula would work only with a table visual with the dimension [Type] and not with others. 

Anyone wit more ideas? It's really urgent for me. 
If I don't find a solution I'll have to do a lot of different meassures, one for each dimension. And it's not efficient at all...

Anonymous
Not applicable

HI @luxpbi,

 

Maybe you can try to use row count as calculate condition :

 

Number =
IF (
    COUNTROWS(Table)=1,
    DIVIDE ( [Amount], [Average Price], BLANK () ),
    SUMX (
        ALLSELECTED ( Table ),
        DIVIDE ( [Amount], [Average Price], BLANK () )
    )
)

 

 

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

Top Kudoed Authors