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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Sudhavi_84
Helper V
Helper V

MedianX is not working Please Help

Hi Experts,

 

I have a PBIX model. Please open link below to download

https://1drv.ms/u/s!An2H1J0iSc93a2if_OCNzJRquIc?e=T1gyog

 

I am able to acheive Measure for Total and Average but Median is showing incorrect value

 

Median value should show 47894 but for some reason it is showing inaccurate value.

 

Sudhavi_84_0-1624017623987.png

 

In Excel I am getting correct Median value please see below

Sudhavi_84_1-1624017841725.png

 

 

1 ACCEPTED SOLUTION
Sudhavi_84
Helper V
Helper V

5 REPLIES 5
Sudhavi_84
Helper V
Helper V

V-pazhen-msft
Community Support
Community Support

@Sudhavi_84 

Try summarizecolumns to a table first then create a median measure.

 

Median =
var table1 = SUMMARIZECOLUMNS(Mstone[Project], "cost measure",[My Measure])
return MEDIANX(table1,[cost measure])
or 
Table = SUMMARIZECOLUMNS(Mstone[Project], "cost measure",[My Measure])
Median measure = median([cost measure])
 
 
Paul Zheng _ Community Support Team

When I use below measure in Card Visual I am getting correct Median

Median =
var table1 = SUMMARIZECOLUMNS(Mstone[Project], "cost measure",[My Measure])
return MEDIANX(table1,[cost measure])
 
So I created a similar measure as you specified and when I am using in Table visual it is coming with error
 
Median measure = median([cost measure])
 
Please help

Hi @V-pazhen-msft .

 

I created Measure for summarise columns as below as you specified

Sudhavi_84_0-1624268956506.png

But median function is not allowing to select measure name. I think I can select only Table/column name isn't it?

 

Sudhavi_84_1-1624269094979.png

 

I am getting error. Could you please let me know where I am wrong here

 

Thank you

 

I am getting correct Median Value in Card visual with below measure but how can I acheive this in to left table please because if you see in left table median is showing incorrect?

 

Sudhavi_84_0-1624353974824.png

My Measure =
(Working Good Excluding total)
VAR XYZMaxDate = CALCULATE(MAX(Mstone[Project Level Date]),Mstone[Project Level] = "XYZ",Mstone[Desc]="Current")
VAR ABCMaxDate = CALCULATE(MAX(Mstone[Project Level Date]),Mstone[Project Level] = "ABC",Mstone[Desc]="Current")
var Prj = SELECTEDVALUE(Mstone[Project])
VAR TOT= CALCULATE(SUM(Fact[Cost]),FILTER('Fact','Fact'[Per] >=XYZMaxDate && 'Fact'[Per]<=ABCMaxDate),Master[Projects]=Prj,Fact[Desc]="Current")
Return TOT
 
 
MeasureTotal = SUMX(VALUES(Mstone[Project]),[My Measure])  Working good including Total
Average = AVERAGEX(VALUES(Mstone[Project]),[My Measure])  Working good for Average
Median = MEDIANX(VALUES(Mstone[Project]),[My Measure])  (This is the issue for me)
 

Please help me to fix this. I attached One drive link for PBIX file.

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.