The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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
Please provide the sample data for your attempt at MEDIAN. Remember this is a selector function, not a calculation.