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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
bikelley
Helper IV
Helper IV

How to get the total value at the end in matrix table?

Hello,

 

Can you please help me to get the Total at the end column only (Sum of Values)?

 

Sample file 

https://drive.google.com/file/d/1YWpad3SKLfT3wnbkDW1WnWjsGRayJhXl/view 

 

I have a matrix table but values are on average. I want to add a sum of values at the end, but when I try to add the Total it is showing by column level as well. Can anybody please let me know how to do it only at the end? I also tried online and did not find anything useful, coz I already have value as average on my matrix table and I just need a sum at the end.  Please see below what I did.

Current table showing the average. 

1.jpg

When I try to add Total at the end, it shows by column level also. which I don't need. 

What I tried, 

 

 

 

Tota_New = IF(ISFILTERED(d_Summary[RegionsSTK]), SUM('d_line (2)'[Value]))
Total = SUM('d_line (2)'[Value])

 

 

2.jpg

 Expect results without highlighted columns, just the sum of the total at the end. 

3.jpg

 Thank you so much

 

1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi, @bikelley ;

Please try :

1.create a column.

sort = RANKX('Timeline',[Status],,ASC,Dense)

2.create a new table.

Newtable = 
var _a=SUMMARIZE('Timeline',[ID],[Status],[sort],"value",AVERAGE(Timeline[Value]))
var _b=SUMMARIZE('Timeline',"ID",BLANK(),"Status","Average","sort",DISTINCTCOUNT(Timeline[Status])+1,"value",BLANK())
return UNION(_a,_b)

3.create a measure.

Measure = IF(SELECTEDVALUE('Newtable'[Status])="Average",AVERAGE('Timeline'[Value]),CALCULATE(SUM('Newtable'[value]), TREATAS(VALUES('Timeline'[ID]),'Newtable'[ID])))

4.sort by "sort" column.

vyalanwumsft_0-1627881544730.png

The final output is shown below:

vyalanwumsft_1-1627881572088.png

Best Regards,
Community Support Team_ Yalan Wu
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

7 REPLIES 7
v-yalanwu-msft
Community Support
Community Support

Hi, @bikelley ;

Please try :

1.create a column.

sort = RANKX('Timeline',[Status],,ASC,Dense)

2.create a new table.

Newtable = 
var _a=SUMMARIZE('Timeline',[ID],[Status],[sort],"value",AVERAGE(Timeline[Value]))
var _b=SUMMARIZE('Timeline',"ID",BLANK(),"Status","Average","sort",DISTINCTCOUNT(Timeline[Status])+1,"value",BLANK())
return UNION(_a,_b)

3.create a measure.

Measure = IF(SELECTEDVALUE('Newtable'[Status])="Average",AVERAGE('Timeline'[Value]),CALCULATE(SUM('Newtable'[value]), TREATAS(VALUES('Timeline'[ID]),'Newtable'[ID])))

4.sort by "sort" column.

vyalanwumsft_0-1627881544730.png

The final output is shown below:

vyalanwumsft_1-1627881572088.png

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-yalanwu-msft you are a rock start my friend, Thank you so much. I almost gave up on this and I saw your post. Thank you so much. This work as I wanted.  Again, I really appreciate your help. 

parry2k
Super User
Super User

@bikelley hang on a second, is that total a measure you have on the value section of the matrix visual?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super User

@bikelley not sure what you are doing? it should be pretty straightforward, send me the pbix file. 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

HI @parry2k 

 

Please see the link below for the sample file. 

https://drive.google.com/file/d/1YWpad3SKLfT3wnbkDW1WnWjsGRayJhXl/view?usp=sharing 

 

Again, I just want to make sure we are on the same page and I am not wasting your time. I want everything except the columns highlighted in yellow (they are the totals). Sorry that I keep repeating this. 

3.jpg

 

Thank you so much. I really appreciate your time and help. 

 

parry2k
Super User
Super User

@bikelley on the format pane, under subtotal, you can turn on "Per Column Level" and turn off the total at the column level.

 

parry2k_0-1627513172948.png

 

 

Follow us on LinkedIn

 

Check my latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

HI @parry2k 

 

Thank you so much for your time, but I tried what you said, and still the same, I want to get rid of the Total for 2,3,4,5 columns, and just keep the end Total column. Am I doing something wrong? 

4.jpg

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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