Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowData Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more
Hi All,
I have a dax formula, see below, to calculate Median. It uses the scores for only selected students and ignores nulls. What I need to do is use distinct values for Score1 while calculating the Median. Is that possible? I think we can use Distinct(), but not sure where should I put that in this DAX. Thanks for your assistance.
MedScore = ROUND(
CALCULATE(
medianx(FILTER(vw_ABC, vw_ABC[Score1]<> BLANK()),
vw_ABC[Score1]) ,
TREATAS(VALUES('vw_Option'[StuName]),vw_ABC[IStuName])
),0
)
Solved! Go to Solution.
Hi @ace_SB
Try this
MedScore =
ROUND (
CALCULATE (
MEDIANX (
FILTER ( VALUES ( vw_ABC[Score1] ), vw_ABC[Score1] <> BLANK () ),
vw_ABC[Score1]
),
TREATAS ( VALUES ( 'vw_Option'[StuName] ), vw_ABC[IStuName] )
),
0
)
Hi @ace_SB
Try this
MedScore =
ROUND (
CALCULATE (
MEDIANX (
FILTER ( VALUES ( vw_ABC[Score1] ), vw_ABC[Score1] <> BLANK () ),
vw_ABC[Score1]
),
TREATAS ( VALUES ( 'vw_Option'[StuName] ), vw_ABC[IStuName] )
),
0
)
Actually this works. Thanks a lot.
Thanks Zubair. Use of Values() is great, but it is still not working. I need to put it in the right place. What I need is median for not null distinct values for only those students picked by the slicer using the view "vw_Option"...
Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.
Check out the May 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 23 | |
| 21 | |
| 20 | |
| 18 | |
| 13 |
| User | Count |
|---|---|
| 58 | |
| 50 | |
| 38 | |
| 31 | |
| 27 |