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
Cscullio
Frequent Visitor

AllSelected In A Summarize Table

I have a table of Months, Salesperson and Sales.

I want to create a summary table of the median sales total for each month.

I am using the following formula

 

FilteredValues = Summarize(AllSelected(AllSales), AllSales[Month], "Median Monthly Sales", Median(AllSales[Units]))

 

But when I filter on a subset of the sales people the table remains static and gives the total for all sales people.

 

How do I create a summary table that calculates median based on the selections only?

5 REPLIES 5
TomMartens
Super User
Super User

Hey,

 

as far as I understand your question I would create a measure like so

 

Median Monthly Sales = 
CALCULATE(
  Median('AllSales'[Units]),
  ALL('AllSales'[Month)
)

 

 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Thanks Tom, but that isn't giving me what i need. 

If we use the example below

Month         SalesPerson            Units

Jan              ID0001                   1000

Jan              ID0002                   2000

Jan              ID0003                   3000

Jan              ID0004                   4000

Jan              ID0005                   5000

 

I want to create a summary table that gives a median of 3000 when there is no filter on SalesPerson but gives a Median of 2000 if I am filtering on ID0001, ID0002 & ID0003 only.

Is that possible to do?

Hey,

 

it's possible 🙂

 

my table is called 'sampleALLSELECTED'

 

Median Units = 
CALCULATE(
	MEDIAN('sampleALLSELECTED'[Units]),
	ALLSELECTED(sampleALLSELECTED[Salesperson])
) 

And you will get this

Sample ALL Selected.png

 

Hope this will help

 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Hi Tom,

Thanks but that is not quite what I am trying to achieve.

I need a table which has one row per month and gives the mendian for each month based on the selections, so I am trying to do this as a Summarize table.  Is there a way to create a summarize table that updates according to selections?   Using AllSelected doesn't seem to have any effect.

 

Hey,

 

you can achieve what you want by using Month the Measure in a table vis

Sample ALL Selected 2.png

 

The second table shows all the data.

 

You can't use a calculated table / virtual table, as a source for a visual, due to the fact that it is static (reflecting the moment (current selections) when you calculate the table.

 

For this reason, you have to use a measure, unfortunately, but currently I can't see why a measure is not "good enough"



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.