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
Yonko
Helper I
Helper I

How to find median from values resulted from another measure?

Hello. Ma problem for today is the following: i've got a table visual with some date, and i wan't to get median from it.
There are some some companies and measure (it just shows random numbers for example), and i need to get the median from it. The problem that is just don't work. I don't know the way to work with data from a measure, displayed on visual and affected by filters. And if i use MEDIANX (tablename, [measure]) then it will be empty.  So, any suggestions?

Yonko_2-1664360790806.png

Desired result:

Yonko_3-1664360975205.png

 

 

 

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

You can use

Median Measure = MEDIANX( ALLSELECTED('Table'[Column]), [measure])

The column you use in the ALLSELECTED needs to be the same column used in the table / matrix visual

View solution in original post

5 REPLIES 5
johnt75
Super User
Super User

You can use

Median Measure = MEDIANX( ALLSELECTED('Table'[Column]), [measure])

The column you use in the ALLSELECTED needs to be the same column used in the table / matrix visual

Yeah, I tried it and it gives me empty values anyway. If the formula is correct, there might be problems with filter context because this measure consists of two different measures and they consist from other ones. I guess i should start with basic measure then and go to the current one and search for the problem.

to make sure that the ALLSELECTED is returning the correct values, you could create a debug measure like

debug = CONCATENATEX( ALLSELECTED('Table'[Column]), 'Table'[Column], ", ")

which should give a comma separated list of all the values from Column

The problem was that instead of using measure i declared a variable and used it instead of measure. When i put measure it worked, so thanks for you help. 
Btw, do you know why variable wasn't working and measure worked?

Variables aren't really variable, they're constants. They are only calculated once, the first time they are declared, so if you define them outside an iterator and then refer to them inside the iterator you will get the same value each time.

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!

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.