This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreDid you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now
I am unable to change the format of a measure. The Formatting section of the Modeling tab only allows Format: Text to be selected. Here's the measure:
NHSSVUNNetAssets = CALCULATE(MEDIAN(AuditNumbers[UnrestNA]),AuditNumbers[PCODE]="8217")
It's possible I am using the wrong DAX. For example, Median is not necessary because the measure filters to one value; however, the measure requires an aggregation. I want the measure displayed as currency. Any help would be great.
Solved! Go to Solution.
That is very strange. It looks like is a bug with the MEDIAN() function. If you change your measure to use AVERAGE() instead of MEDIAN() it allows you to format the measure in formats besides Text.
One way to get around this bug would be to calculate the median without using the MEDIAN() function. SQL BI has a great desctiption of how you would write your own MEDIAN measure in DAX.
It would look like this for your model:
Custom Median :=
(
MINX (
FILTER (
VALUES ( AuditNumbers[UnrestNA] ),
CALCULATE (
COUNT ( AuditNumbers[UnrestNA] ),
AuditNumbers[UnrestNA]
<= EARLIER ( AuditNumbers[UnrestNA] )
)
> COUNT ( AuditNumbers[UnrestNA] ) / 2
),
AuditNumbers[UnrestNA]
)
+ MINX (
FILTER (
VALUES ( AuditNumbers[UnrestNA] ),
CALCULATE (
COUNT ( AuditNumbers[UnrestNA] ),
AuditNumbers[UnrestNA]
<= EARLIER ( AuditNumbers[UnrestNA] )
)
> ( COUNT ( AuditNumbers[UnrestNA] ) - 1 ) / 2
),
AuditNumbers[UnrestNA]
)
) / 2Then change your measure to use the custom median measure and you will be able to change the format of this measure to currency.
NHSSVUNNetAssets = CALCULATE([Custom Median] ,AuditNumbers[PCODE]="8217")
I found a fix to this was to just put a vlue around the outside 🙂
NHSSVUNNetAssets = Value(CALCULATE(MEDIAN(AuditNumbers[UnrestNA]),AuditNumbers[PCODE]="8217"))
Why is this marked "Solved?" There is still a bug in Median aggregation which prevents numbers from being formatted as anything other than text.
The bug is still there
Try SUM or MAX instead of MEDIAN
That is very strange. It looks like is a bug with the MEDIAN() function. If you change your measure to use AVERAGE() instead of MEDIAN() it allows you to format the measure in formats besides Text.
One way to get around this bug would be to calculate the median without using the MEDIAN() function. SQL BI has a great desctiption of how you would write your own MEDIAN measure in DAX.
It would look like this for your model:
Custom Median :=
(
MINX (
FILTER (
VALUES ( AuditNumbers[UnrestNA] ),
CALCULATE (
COUNT ( AuditNumbers[UnrestNA] ),
AuditNumbers[UnrestNA]
<= EARLIER ( AuditNumbers[UnrestNA] )
)
> COUNT ( AuditNumbers[UnrestNA] ) / 2
),
AuditNumbers[UnrestNA]
)
+ MINX (
FILTER (
VALUES ( AuditNumbers[UnrestNA] ),
CALCULATE (
COUNT ( AuditNumbers[UnrestNA] ),
AuditNumbers[UnrestNA]
<= EARLIER ( AuditNumbers[UnrestNA] )
)
> ( COUNT ( AuditNumbers[UnrestNA] ) - 1 ) / 2
),
AuditNumbers[UnrestNA]
)
) / 2Then change your measure to use the custom median measure and you will be able to change the format of this measure to currency.
NHSSVUNNetAssets = CALCULATE([Custom Median] ,AuditNumbers[PCODE]="8217")
Thank you for your help, Twan. Using AVERAGE() instead of MEDIAN() allows the format to be changed. Also, thank you for including a reference to the custom function.
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 34 | |
| 31 | |
| 30 | |
| 21 | |
| 16 |
| User | Count |
|---|---|
| 62 | |
| 51 | |
| 31 | |
| 23 | |
| 23 |