Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

plot median value for selected category

I'm trying to plot the median value of counts for 'SC' category based on selection of 'deposit balance group' category on a bar chart. I created a measure using DAX which can calculate the median values. But it looks like my DAX formula is wrong and it's calculating the median for the entire table and not per category.

 

For Eg, The median value for $100K-$150K group for 'CD' category should be 36, but its showing 270 on the bar chart.

 

My sample data:

 

countSCDeposit Balance Group
20CDGT $2M
18CD$150K-$200K
12CD$200K-$250K
42CD$200K-$250K
17CK$100K-$150K
11CK$100K-$150K
11CK$100K-$150K
17CK$100K-$150K
47CK$100K-$150K

 


The DAX measure I created:

 

 

Measure = 
MEDIANX (
    SUMMARIZE (
        Sheet1,
        Sheet1[SC],
        "Total Count", SUM ( Sheet1[count] )
    ),
    [Total Count]
)

 


Please let me know how can I overcome this situation.

 

Thanks

I've attached the pbix file which has the complete data and measure formula: pbix file 

 

1 ACCEPTED SOLUTION
dedelman_clng
Community Champion
Community Champion

Hi @Anonymous -

 

You're over-thinking it 😊.  By doing a Summarize you are totalling all of the counts and then performing MEDIAN on a single value. You would do something similar if you needed to count up the records from raw data, but since you already have the counts, all your measure needs is MEDIAN()

 

2020-10-30 11_09_03-median - Power BI Desktop.png

 

Hope this helps

David

View solution in original post

1 REPLY 1
dedelman_clng
Community Champion
Community Champion

Hi @Anonymous -

 

You're over-thinking it 😊.  By doing a Summarize you are totalling all of the counts and then performing MEDIAN on a single value. You would do something similar if you needed to count up the records from raw data, but since you already have the counts, all your measure needs is MEDIAN()

 

2020-10-30 11_09_03-median - Power BI Desktop.png

 

Hope this helps

David

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.