PowerBI - calculate difference of two median values

jeroentjev

New Member
Joined
Aug 5, 2014
Messages
2
Hi all,

Hope you can help me with the following question;
I have a couple of columns with data:
- Column A consists of numeric data (revenue growth in %)
- Column B consists of numeric & Text data (year: 2016, 2017, 2018 and current)
- Column C consists of text fields (different geographical areas)
- Column D consists of text fields (different companies in the geographical areas)

I want to calculate the difference of the median in revenue growth within a geographical area over 2 time periods (the time periods [column B] and geographical area [column D] can be selected on a dashboard) (Are you still with me?;))

I'm using the following formula:

Median of rev growht (of latest year [in B], for selected geo-area [in C]) - Median of rev growht (of latest year - 1 [in B], for selected geo-area [in C])

Somehow I can't figure out how I should code this in DAX. Currently it looks like this:

Revenue growth (%) =
var previousdate = CALCULATE(MAX('Table'[Year]);FILTER(ALLEXCEPT('Table';'Table'[Company]);'Table'[Year]<MAX('Table'[Year]))
)
var previousvalue = LOOKUPVALUE('Table'[Revenue growth];'Table'[Year];previousdate;'Table'[Company];MAX('Table'[Company]))
return IF(ISBLANK(previousvalue);BLANK();(MEDIAN('Table'[Revenue growth])-previousvalue)*10000)


MANY THANKS!
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.

Forum statistics

Threads
1,213,482
Messages
6,113,916
Members
448,533
Latest member
thietbibeboiwasaco

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top