Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
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.
User | Count |
---|---|
12 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
24 | |
19 | |
14 | |
10 | |
7 |