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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Woncarc
Frequent Visitor

How to do add a column for cumulative sum in a matrix visual

Hi!

 

I'd like to know how to do something like this in a matrix visual:

 

Woncarc_1-1747320305767.png

 

I have a fact table with components sold, and a calculated column that tells you the month it has been sold.

I've tried to add a calculated column to put the month period, but it doesn't work, as it only lets me go to another level of hierarchy.

 

Thanks!

 

 

2 ACCEPTED SOLUTIONS

Hi @Woncarc ,

 

Please refer below sample data snap.

vdineshya_0-1747836445182.png

I have created some measures and placed in value fields.

Please refer sample output snap.

vdineshya_1-1747836690333.png

Please find the attached snaps and sample Pbix file for your reference.

 

If my response has resolved your query, please mark it as the "Accepted Solution" to assist others. Additionally, a "Kudos" would be appreciated if you found my response helpful.

Thank you

View solution in original post

Hi @Woncarc ,

If my response has resolved your query, please mark it as the "Accepted Solution" to assist others. Additionally, a "Kudos" would be appreciated if you found my response helpful.

Thank you

View solution in original post

7 REPLIES 7
v-dineshya
Community Support
Community Support

Hi @Woncarc ,

Thank you for reaching out to the Microsoft Community Forum.

 

Please follow below steps.

1. I took sample data as Sales table ( Component, Monthsold,Quantity columns).

2. I have created "Month Group" calculated column for Sales Table.

 

MonthGroup =
SWITCH(
TRUE(),
Sales[MonthSold] <= 3, "1 to 3",
Sales[MonthSold] <= 6, "4 to 6",
Sales[MonthSold] <= 9, "7 to 9",
"10 to 12"
)

3. Created "Total Quantity" calculated column .

 

Total Quantity = SUM(Sales[Quantity]) 

 

4. Created "Cumulative Quantity" calculated measure .

 

Cumulative Quantity =
CALCULATE(
[Total Quantity],
FILTER(
ALL(Sales[MonthSold]),
Sales[MonthSold] <= MAX(Sales[MonthSold])
)
)

 

5. Placed "Component" field in Rows, "MonthGroup" in column and "TotalQuantity" in values

 

Please find below snaps of sample data and sample output.

vdineshya_0-1747382160786.pngvdineshya_1-1747382189174.png

 

If my response has resolved your query, please mark it as the "Accepted Solution" to assist others. Additionally, a "Kudos" would be appreciated if you found my response helpful.

Thank you

Hi @Woncarc ,

If my response has resolved your query, please mark it as the "Accepted Solution" to assist others. Additionally, a "Kudos" would be appreciated if you found my response helpful.

Thank you

Hi.

Thanks for the solution, but I'd like to also get the individual months on the matrix visual.

For example, in your viz it should appear 

         1       2       3       1 to 3

C1     9      25     29         63

C2     0       1       2           3

Hi @Woncarc ,

 

Please refer below sample data snap.

vdineshya_0-1747836445182.png

I have created some measures and placed in value fields.

Please refer sample output snap.

vdineshya_1-1747836690333.png

Please find the attached snaps and sample Pbix file for your reference.

 

If my response has resolved your query, please mark it as the "Accepted Solution" to assist others. Additionally, a "Kudos" would be appreciated if you found my response helpful.

Thank you

Hi @Woncarc ,

If my response has resolved your query, please mark it as the "Accepted Solution" to assist others. Additionally, a "Kudos" would be appreciated if you found my response helpful.

Thank you

Hi @Woncarc ,

If my response has resolved your query, please mark it as the "Accepted Solution" to assist others. Additionally, a "Kudos" would be appreciated if you found my response helpful.

Thank you

ExcelMonke
Super User
Super User

Hello,

My recommendation would be to consider using a Date Dimension table and connect it to your fact table. Within this date dim I would recommend defining your periods (e.g. Months January through March are equal to period Q1).
From there you can create an easy matrix to where your components sold easily roll up per period they are sold. This is all assuming you have a date column in your fact table.

 

This is what would be best practice for Power BI, but if for some reason you have limitations within your data set to where you are unable to do this, you can consider adding a calculated column for each period along the following lines:

Calculated Col 1 to 3 = 
Table[col1] + Table[col2] + Table[col3]

Repeat for each period. Again, not best practice, but it should get you what you need. 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





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.