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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Carlo1975
Helper I
Helper I

Matrix table with sum

Hi, I have a problem and I don't know how to overcome it. I don't know if the solution is Dax or power query. I'm sorry.

I try to explain.

 

I have a table like this. With 2 clusters columns, one column with the quarters, and one with an amount:

 

1.JPG

 

If I try to do a matrix table I don't have any problem

 

up to here everything is quite simple.

 

The problem is that, for each row, I have to sum the previous value with the following. And so, if you look at first row, you have for the first quarter 150, the second 150 and on the last one 700:

 

1.JPG

 

In my new Matrix Table I have to do this: On the first quarter I will have 150, on the second quarter 300 (because I have to sum the 150 on the first quarter, to the second). In the third quarter, I will have 1000 because I will sum 150 (first quarter), 150 (second quarter) and 700 (last one). The new first row will be:

 

Cattura2.JPG

 

This one, for all the row and all the quarters.

 

Ok....for this problem CNENFRNL said me the best solution and I used it:

 

Accum = 
VAR __qtr = MAX ( Table1[Quarter] )
RETURN
    CALCULATE ( SUM ( Table1[Amount] ), Table1[Quarter] <= __qtr )

 

https://community.powerbi.com/t5/DAX-Commands-and-Tips/Matrix-table-with-sum/m-p/1521406#M29672

 

But now I have another problem....I don't have to use absolute numbers but percentages and I cannot use the power BI options "show value as a percentage of grand total".

Is it possible using the DAX code above and my example to have a percentage cumulative Value?

thank you

Carlo

 

1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

@Carlo1975 , you might want to try

% Accum =
VAR __gt = SUMX ( ALL ( Table1[Cluster2], Table1[Quarter] ), [Accum] )
RETURN
    DIVIDE ( [Accum], __gt )

Screenshot 2020-12-16 180749.png

 


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

4 REPLIES 4
CNENFRNL
Community Champion
Community Champion

@Carlo1975 , you might want to try

% Accum =
VAR __gt = SUMX ( ALL ( Table1[Cluster2], Table1[Quarter] ), [Accum] )
RETURN
    DIVIDE ( [Accum], __gt )

Screenshot 2020-12-16 180749.png

 


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

I'm sorry, what is Cluster2?

CNENFRNL
Community Champion
Community Champion

Hi, @Carlo1975 , do you expect this?

Screenshot 2020-12-16 153954.png

You might want to add another measure,

% Accum = 
DIVIDE( [Accum], CALCULATE( SUM( Table1[Amount] ) , ALL( Table1[Quarter] ) ) )

Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

HI CNENFRNL and Thank you....with this I obtain always 100% on my chart, instead I have to have this:

 

Cattura.JPG

 

And so each percentage, is a percentage on the grand total (4.190)...the sum of all the percentage will be 100%

 

150 is the 4% of grand total 4.190

300 is the 7% of grand total 4.190

 

I hope to explain well my problem.

thank you

Carlo

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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