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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
TM_
Frequent Visitor

Min of Median Measure Within Category

I have created a measure to calculate the median of a set of values per sub-category.

I would like to now have the min. of the medians of those sub-categories - example below.

Any idea how I can achieve this in Power BI w/DAX?

Thank you.

 

TM__0-1737472874036.png

 

FYI - Tried this method but not returning the desired values: 

Measure 2 =
Calculate(
MINX(Test,[Measure]),
ALLEXCEPT(Test,Test[Category])

1 ACCEPTED SOLUTION
TM_
Frequent Visitor

I've resolved by adding on: 

 

Min_Of_Medians =
CALCULATE(
MINX(
    SUMMARIZE(
        'Test',
        'Test'[Subcategory]
            ),
[Median]
),
ALLEXCEPT('Test', 'Test'[Category])
)
 
Then I created another measure for conditional formatting:
 
 IF(
    [Median] = [Min_Of_Medians],
    1,
    BLANK()
 )
 
And utilised this to colour the background of only the min. values.
 
Thanks again for your help!

View solution in original post

3 REPLIES 3
rajendraongole1
Super User
Super User

Hi @TM_  - Create a measure to calculate the median for each subcategory

Median_Per_Subcategory =
MEDIANX(
FILTER(
Test,
Test[Sub Category] = MAX(Test[Sub Category])
),
Test[Value]
)

 

you can create another measure to calculate the minimum of the medians for each category:

Min_Of_Medians =
MINX(
SUMMARIZE(
Test,
Test[Sub Category],
"Median", [Median_Per_Subcategory]
),
[Median]
)

Now, you can add the Min_Of_Medians measure to your visual or card to display the desired minimum of the medians for each category.

This approach should return the expected values you highlighted in the Expected Value column (e.g., 2 for Category A, 8 for Category B, and 14 for Category C).





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

Proud to be a Super User!





Hi @rajendraongole1  - many thanks for your reply!

 
I tried this method and the results were as follows:
 
TM__1-1737536212026.png

How do I amend to make it so that the Min_Of_Medians will show up as:

- 2 consistently for Category A, Sub-Categories a,b,c rather than 2,4,6. 

- 8 consistently for Category B, Sub-Categories a,b,c rather than 8,10,12. 

- 14 consistently for Category C, Sub-Categories a,b,c rather than 14,16,18.

 

My end goal here is to then use the Min_Of_Medians measure as a conditional formatting tool to colour the minimum value in the Median_Per_Subcategory per Category. Essentially the below:  

TM__2-1737536459594.png

Thank you. 

 
TM_
Frequent Visitor

I've resolved by adding on: 

 

Min_Of_Medians =
CALCULATE(
MINX(
    SUMMARIZE(
        'Test',
        'Test'[Subcategory]
            ),
[Median]
),
ALLEXCEPT('Test', 'Test'[Category])
)
 
Then I created another measure for conditional formatting:
 
 IF(
    [Median] = [Min_Of_Medians],
    1,
    BLANK()
 )
 
And utilised this to colour the background of only the min. values.
 
Thanks again for your help!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors