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
mafaber
Helper II
Helper II

Different Measure Total using SUMX

Hi,

 

I would like to change how my measure calculates the total. For that I'm using the HASONEFILTER function and that works just fine, it correctly evaluates the first expression for each value row and total expression for the total row, but for the total row I just can't get the result right. Basically what I'd like to do is instead of evaluating the expression on the totals, I want to see the expression evaluated for each row and then summed up. To my understanding that is what SUMX is for, but it is somehow not correct.

What am I doing wrong?

 

Measure_test =

switch(true(),

hasonefilter(master_customer_database[Market]),

divide(sum(table1[column1]), sum(table1[column2])),

sumx(table1, divide(sum(table1[column1]), sum(table1[column2])))

)

1 ACCEPTED SOLUTION
tex628
Community Champion
Community Champion

Try something like this for the total:

Measure2 = 
SUMX(
SUMMARIZE(
'Table';
'Table'[Category];
"Value" ; [Measure]
) ;
[Value]
)


Br,
J


Connect on LinkedIn

View solution in original post

6 REPLIES 6
PaulDBrown
Community Champion
Community Champion

@mafaber 

 

Try the following (I'm using random data):

1) the measures:

Sum of Actuals = SUM('Data Table'[Actuals])
Sum of Target = SUM('Data Table'[Target])
Actuals / Target = DIVIDE([Sum of Actuals]; [Sum of Target])
SUMX of Actuals / Target = SUMX(SUMMARIZE('Data Table'; 'Data Table'[Channel]; 
                            "Calculation"; [Actuals / Target]); 
                                [Calculation])

 

And you will get this result

result.JPG

 

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Anonymous
Not applicable

Thanks buddy, this resolved a big issue for me.
Anonymous
Not applicable

share sample data and expect output

CategoryValue1Value2Measure (Value1/Value2)
Cat117784702179768.16

Cat2

249663413229418.87
Total427510435027024.41

 

So as you can see Measure is Value1 / Value 2 for each row. The Total Value 1 and Total Value 2 is also correct.

I noticed now that the 24.41 is the double of what the Total Value1 / Total Value2 would be (12.205). But I don't see why.

 

Expected result would be 8.16+18.87=27.03

tex628
Community Champion
Community Champion

Try something like this for the total:

Measure2 = 
SUMX(
SUMMARIZE(
'Table';
'Table'[Category];
"Value" ; [Measure]
) ;
[Value]
)


Br,
J


Connect on LinkedIn

It works, thank you all!

 

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.