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
Superuser27
New Member

Sum of Median values

I have a table with data with different categories (1, 2,..., n). I managed to calculate the median value for each category with 

Measure = 
MEDIANX(
	KEEPFILTERS(VALUES('Table'[Category]));
	CALCULATE(MEDIAN('Table'[Values]))
)

but then when I want to calculate the sum over all categories of those median values I can't manage to achieve it.

Since there is no option on how to aggregate the measure in visuals, I tried defining the sum of those values in different ways, such as the following:

 

Measure = 
CALCULATE(SUMX(Table;
MEDIANX(
	KEEPFILTERS(VALUES('Table'[Category]));
	CALCULATE(MEDIAN('Table'[Values]))
)))

But it just sums all the values.

Any idea on how to get the sum of the single medians, instead of the median of the medians as a "Total" e.g. in a table view?

 

TL;DR: how do I get the sum here, instead of median, of the measure? 

Superuser27_0-1601026869222.png

 

1 ACCEPTED SOLUTION

ok try use 

 

Measure 3 = CALCULATE(SUMX(VALUES('Table'[Category]),[Measure]))
 






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

Proud to be a Super User!




View solution in original post

4 REPLIES 4
FarhanAhmed
Community Champion
Community Champion

Try below and use measure 2 in visual

 

Measure = 
MEDIANX(
	KEEPFILTERS(VALUES('Table'[Category]));
	CALCULATE(MEDIAN('Table'[Values]))
)
Measure 2= 
CALCULATE(SUMX(Table;[Measure]))

 







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

Proud to be a Super User!




Hi @FarhanAhmed  and thanks for your quick reply. Unfortunately that does the same thing as the second snippet I posted. It just sums all the values.

Superuser27_0-1601027701971.png

 

ok try use 

 

Measure 3 = CALCULATE(SUMX(VALUES('Table'[Category]),[Measure]))
 






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

Proud to be a Super User!




Yes! That does exactly what I needed! Thank you so much! @FarhanAhmed 

Superuser27_0-1601027939018.png

 

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.