- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Median Measure using Distinct Values
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 )
Regards
Zubair
Please try my custom visuals
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 )
Regards
Zubair
Please try my custom visuals
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Actually this works. Thanks a lot.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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"...
Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - January 2025
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
Subject | Author | Posted | |
---|---|---|---|
08-19-2024 08:35 PM | |||
07-21-2024 09:43 PM | |||
07-31-2024 01:50 PM | |||
12-04-2023 02:13 PM | |||
09-29-2023 12:44 AM |
User | Count |
---|---|
104 | |
75 | |
43 | |
39 | |
32 |
User | Count |
---|---|
170 | |
90 | |
65 | |
46 | |
44 |