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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
serenearchana
New Member

Issue with DAX Median Calculation Returning Whole Numbers Instead of Decimals

Hello Community,

I am encountering an issue with a DAX expression in Power BI, where the median calculation is returning whole numbers instead of the exact median with proper decimal values. Here is the DAX expression I am using:



Median Metric =
VAR CurrentMetric = SELECTEDVALUE(UnpivotedData[metric])
VAR CurrentUnitCode = SELECTEDVALUE(rt_unit[CODE])
VAR CurrentStatus = SELECTEDVALUE(rts_project[STATUS])
RETURN
IF(
AND(
AND(NOT ISBLANK(CurrentMetric), NOT ISBLANK(CurrentUnitCode)),
NOT ISBLANK(CurrentStatus)
),
CALCULATE(
MEDIAN(UnpivotedData[value]),
ALLEXCEPT(UnpivotedData, UnpivotedData[metric]),
rt_unit[CODE] = CurrentUnitCode,
rts_project[STATUS] = CurrentStatus,
UnpivotedData[value] > 0,
NOT ISBLANK(UnpivotedData[value])
),
BLANK()
)

For example, if the expected median is 4.25, the result I am getting is 4. I have attempted to adjust the number format to include decimals, but the output still shows as whole numbers with trailing zeros.

This issue is urgent, and I would greatly appreciate any assistance or guidance on how to resolve this problem to get the exact median with proper decimals.

Thank you in advance for your help.

Best regards,
Archana

1 REPLY 1
lbendlin
Super User
Super User

Please provide the sample data for your attempt at MEDIAN.  Remember this is a selector function, not a calculation.

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.