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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Anonymous
Not applicable

Sum of matrix columns.


down vote
favorite
I have to create the following MatrixPreview:

Month      january                                   february
Desc            Value       sum_Value               Value       sum_Value
DescA          V_A           V_A + V_B + V_C       V_X       V_X + V_Y + V_Z
DescB          V_B           V_A + V_B + V_C       V_Y        V_X + V_Y + V_Z
DesC           V_C           V_A + V_B + V_C       V_Z        V_X + V_Y + V_Z

 

This is my data relationship:

relationship.png

 

 

These are my fields:

fields.png

 

 

And this is my table:

table.png

 

I have to create a new measure or column that contains a DAX formula to sum all the values by month. How can I that using my data?

1 ACCEPTED SOLUTION
dedelman_clng
Community Champion
Community Champion

Basically you want to remove the "filter" on Descgrupo that the matrix forms implicitly, while keeping the "filter" for Mes.  You will use the ALL() function on the column to remove that filter.  The filter on Mes will remain.

 

FirstSM = Calculate( sum(VRTOTAL), ALL('Groupo De Despesa'[Descgrupo]) )

 

Hope this helps

David

View solution in original post

6 REPLIES 6
dedelman_clng
Community Champion
Community Champion

Basically you want to remove the "filter" on Descgrupo that the matrix forms implicitly, while keeping the "filter" for Mes.  You will use the ALL() function on the column to remove that filter.  The filter on Mes will remain.

 

FirstSM = Calculate( sum(VRTOTAL), ALL('Groupo De Despesa'[Descgrupo]) )

 

Hope this helps

David

HI

 

In my matrix below there are 2 things I need to do

 

1. How do I sum only the months ( I.e January to September) doing this will provide me with my Flows YTD and this formula should not include the opening nav and closing nav. This information should be displayed between the September column & Closing NAV column

 

2. Thereafter i need to have a market movement column, which will be calculated by taking Closing NAV less Flows YTD (calculated above) less Opening NAV

 

This column should then be displayed between the Flows YTD column and Closing NAV column

 

Please could someone assist me

snapshot.PNG

 

 

 

 

 

 

 

Hi @TH123 - I would suggest you create a new post for your question, as this one is marked as solved. Include sample data and expected outcomes and you're likely to get more assistance.

Anonymous
Not applicable

@dedelman_clng, thank you, it worked! But I did not understand your explanation, can you explain me again?

DAX uses the concept of "filter context" to define the "conditions" under which a value is calculated.  When you create a matrix or table view in PowerBI, the filter context becomes the rows and columns that you have in your visual.

 

The CALCULATE function allow you to do "context transition" which replaces and/or augments the current filter context with whatever conditions you specify after the expression to be calculated.  I come from a SQL background, so I often think of CALCULATE giving you the ability to specify a "WHERE" clause, but in DAX.

 

In your case, you want the value to only look at month and not at category.  So by using CALCULATE and doing a context transition to ALL categories (instead of the one specified by the row), you get DAX to give you a different value.

 

Microsoft offers some basic training on DAX at the end of the curriculum here: Power BI Self-Guided Learning.  They also have other resources here: DAX Resource Center

 

Hope this makes sense.

David

Anonymous
Not applicable

Thanks for your solution, suggestions and assistence!

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.