Hi -- I'm having trouble taking the median value of a population of companies' revenue growth % for a number of years.
Below is a sample of the table I'm working off of (Company Name is from 1 table, Year is from a Date/Calendar table, and the next 3 are Measures based on the Company Name table):
|Company Name||Year||Total Rev ($USDmm)||Total Revenue LY||Rev % Chanage YoY|
|1st Source Corporation||2012||$227.00|
|1st Source Corporation||2013||$233.30||227||2.80%|
|1st Source Corporation||2014||$234.50||233.3||0.50%|
|1st Source Corporation||2015||$247.70||234.5||5.60%|
|1st Source Corporation||2016||$252.80||247.7||2.10%|
|1st Source Corporation||2017||$275.40||252.8||8.90%|
|1st Source Corporation||2018||275.4|
Rev % Chanage YoY = DIVIDE([Diff. Between Rev TY and LY], [Total Revenue LY])
I've tried to use MEDIANX():
MED % Change YoY = MEDIANX(FILTER(Normalized_Test, NOT(ISBLANK([Rev % Chanage YoY]))), [Rev % Chanage YoY])
I keep getting (Blank) value returns, even after trying to control for that. Clearly there's something I'm missing, or I'm not approaching the question correctly.
I'm trying to get the median value of all companies per year that will work with other filters on the table.
Any insight would be greatly appreciated, thanks.
Please try this:
MED % Change YoY = CALCULATE ( MEDIANX ( FILTER ( Normalized_Test, NOT ( ISBLANK ( [Rev % Chanage YoY] ) ) ), [Rev % Chanage YoY] ), ALL ( Normalized_Test[Company Name] ) )
Hmmm, thanks v-yulgu-msft -- still throwing up blanks. Table with the attempted formula use below (All companies):
|Year||Total Rev ($USDmm)||Total Revenue LY||Rev % Chanage YoY||MED % Change YoY|
Could this be an issue with using a calendar table (seperate from the table that houses the Company data).
For tables (3 involved) I have Calendar[Date] = Normalized_Test[Fiscal Year]; Normalized_Test[SIC Code] = ref_SIC_Codes[SIC Code]
Normalized_Test is where I'm running the measures to get the Year-over-Year data.
Total Rev ($USDmm) = SUM([Total Revenue ($USDmm)])
Total Revenue ($USDmm) LY = CALCULATE([Total Rev ($USDmm)], SAMEPERIODLASTYEAR('Calendar'[Date]))
Diff. Between Rev TY and LY = IF(OR(ISBLANK([Total Revenue LY]),ISBLANK([Total Rev ($USDmm)])), BLANK(), [Total Rev ($USDmm)] - [Total Revenue LY])
And then, use these to calculate YoY: Rev % Chanage YoY = DIVIDE([Diff. Between Rev TY and LY], [Total Revenue LY])
And then from here is where the problem happens -- trying to create a Median measure on top of the Rev % Change YoY
Trying to think through the problem outloud -- I need to have DAX iterate over every instance of a company's YoY by each year. So, the measure would take every single instance of 2013's Rev % Change YoY for each company (~2700 rows), and return the median value.
Since I'm using a separate Calendar table for date calculations, would I need to include that somehow in the calculation RELATED(), etc.?