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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
abhiiimr15
Frequent Visitor

DAX on Median Calculation

Hi,

I am struggling with DAX wherein I would like to know the Median Price and Max Price of the set of products from the following data set.

Avg. Cost of the region will be per region ID and is displayed in Avg. Cost in region colum. (=Cost/Product COunt).

Also, Median Price I would like to calculate across all regions

And also the Max Price across all regions.

Any help???

 

Region IDCostProduct CountAvg. Cost in region
4770208111
8439382448222.18
393862202893.11
11043926115442.61
2905757320102
3449393164232.78
8109525322131.69
3886453620111.82
6976799867262.58
77824349212
19635856522.5
2399631749163.06
95955920522.5
719186711042.5
537416792173
7346700845172.65
93243941942.25
514721161662.67
417901212
7897329747162.94
30917529522.5
1965506637123.08
3172795145222.05
75585923723.5
965040192683.25
98073814321.5
67489965193.42
37642492522.5
70617906522.5
3 REPLIES 3
AlB
Super User
Super User

Hi @abhiiimr15 

Not sure I understand fully. Once you have Avg. Cost in region, would it suffice to create two new measures?

 

MedianPrice = MEDIAN(Table1[Avg. Cost in region])

and

 

MaxPrice = MAX(Table1[Avg. Cost in region])

 

'm sorry if I was not very clear. Actually my requirement is at the following level

reqd..PNG

 

Below is the data table of the above screen shot. 

 

Super GeoCountryRegion IDCostProduct CountAvg. Cost in regionMedian at Country levelMedian at Super Geo levelMax Price at Country levelMax Price at Super Geo level
A14770208111                                    2.18                                        2.34                                        3.11                                            3.11
A18439382448222.18    
A1393862202893.11    
A111043926115442.61    
A12905757320102    
A23449393164232.78    
A28109525322131.69                                    2.50 3.06 
A23886453620111.82    
A26976799867262.58    
A277824349212    
A219635856522.5    
A22399631749163.06    
A295955920522.5    
B3719186711042.5                                    2.58                                        2.58                                        3.00                                            3.08
B3537416792173    
B37346700845172.65    
B393243941942.25    
B4514721161662.67                                    2.59 3.08 
B4417901212    
B47897329747162.94    
B430917529522.5    
B41965506637123.08    
B43172795145222.05    
C575585923723.5                                    2.88                                        2.88                                        3.50                                            3.50
C5965040192683.25    
C598073814321.5    
C567489965193.42    
C537642492522.5    
C570617906522.5    

You can still use the measures above in table visual where you need to place in rows the level you want to look at: Country or Super Geo

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors