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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
olivierpkz
Regular Visitor

Total of a measure without row context ?

Hello !

 

I have a problem in a DAX formula to retrieve the total of a measure and use it in another measure.

 

I explain the context :

I have a salary table with 1 row by employee / month, and each salary belong to a category.

 

I need to display the number of man / woman by category, and then calculate a measure using the total number of employees :

 

I begin to make a matrix summarized by Category in row and Gender in columns, like this :

 Number ManNumber WomanTotal
Category A4610
Category B325
Category C7512
Category D8311
TOTAL221638

 

The problem is when I try to add a measure to this table in which I have to retrieve the total number of employees (38), it always keep the context of my matrix and calculate the number by category.

 

I try all the solutions I found on the forum (using ALL, ALLEXCEPT, ISFILTERED) without success.

 

The measure must be calculate for each category but in my DAX formula I just need to use 38, for example in the line Category A I must calculate a ponderate coefficient : 10/38

 

It seems obvious but I admit I fail to do this...

 

If someone knows a solution, it will be great, thank you !

 

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

Hi @olivierpkz ,

 

I created a sample table like yours. The “Number Man” and “Number Woman” measures calculated the counts of man or woman. The “Total” are the sum of the previous two measures. Now, you need to create a measure to get the total value as a coefficient.

TotalDiv =
[Total] & "/"
    & SUMX ( ALL ( 'Table' ), 'Table'[Number] )

3-1.PNG

"SUMX ( ALL ( 'Table' ), 'Table'[Number] )" is the code you want.

 

Best Regards,

Eads

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

4 REPLIES 4
v-eachen-msft
Community Support
Community Support

Hi @olivierpkz ,

 

I created a sample table like yours. The “Number Man” and “Number Woman” measures calculated the counts of man or woman. The “Total” are the sum of the previous two measures. Now, you need to create a measure to get the total value as a coefficient.

TotalDiv =
[Total] & "/"
    & SUMX ( ALL ( 'Table' ), 'Table'[Number] )

3-1.PNG

"SUMX ( ALL ( 'Table' ), 'Table'[Number] )" is the code you want.

 

Best Regards,

Eads

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

Hello and thank you for your help !

Your measure keep the context of the matrix rows, it doesn't show the total I want :

 

Here is the measure : 

Effectif Test = SUMX(ALL('Salariés - Salariés');[FH - Effectif])
 
And the result :
2019-09-04 10_01_12-_SagePaie2 - Power BI Desktop.png
 
I need to calculate 36 for each row...
 
Any other ideas please ?
 

@v-eachen-msftany ideas how to do it ? Thank you very much !

RobbeVL
Impactful Individual
Impactful Individual

Hi There,

 

I think the easiest in this context would be to add a calculated column.
Add a column "Category" with IF salary < 1000 ; "Category A", ...
Then just drag a Category to columns  and you'll have your table.

 

Hope this helps.

 

Robbe

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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