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.
Hello BI Team
I am trying to determine the Median % change based on the previous 12 months.
How can i determine the Median % when the data is a measure?
In this example data set the Median from Nov-19 would be based on Nov-18 to Oct-19. This sample table is connected to a date table.
MMM_YYYY | Total | Prev_Month | Change | % Change |
Jan-18 | 700,000 | |||
Feb-18 | 400,000 | 700,000 | (300,000) | -42.9% |
Mar-18 | 1,000,000 | 400,000 | 600,000 | 150.0% |
Apr-18 | 1,300,000 | 1,000,000 | 300,000 | 30.0% |
May-18 | 1,400,000 | 1,300,000 | 100,000 | 7.7% |
Jun-18 | 1,200,000 | 1,400,000 | (200,000) | -14.3% |
Jul-18 | 1,100,000 | 1,200,000 | (100,000) | -8.3% |
Aug-18 | 1,100,000 | 1,100,000 | - | 0.0% |
Sep-18 | 900,000 | 1,100,000 | (200,000) | -18.2% |
Oct-18 | 1,000,000 | 900,000 | 100,000 | 11.1% |
Nov-18 | 800,000 | 1,000,000 | (200,000) | -20.0% |
Dec-18 | 800,000 | 800,000 | - | 0.0% |
Jan-19 | 1,000,000 | 800,000 | 200,000 | 25.0% |
Feb-19 | 800,000 | 1,000,000 | (200,000) | -20.0% |
Mar-19 | 900,000 | 800,000 | 100,000 | 12.5% |
Apr-19 | 900,000 | 900,000 | - | 0.0% |
May-19 | 1,000,000 | 900,000 | 100,000 | 11.1% |
Jun-19 | 1,000,000 | 1,000,000 | - | 0.0% |
Jul-19 | 1,200,000 | 1,000,000 | 200,000 | 20.0% |
Aug-19 | 1,000,000 | 1,200,000 | (200,000) | -16.7% |
Sep-19 | 900,000 | 1,000,000 | (100,000) | -10.0% |
Oct-19 | 900,000 | 900,000 | - | 0.0% |
Nov-19 | 300,000 | 900,000 | (600,000) | -66.7% |
300,000 | (300,000) | -100.0% |
Solved! Go to Solution.
Now that I have everything as a column in my Summary table. I think this might work for me.
Try something like this
Sum Sales = sum(sales[sales amount])
Rolling 12 Median = CALCULATE(MEDIANX(VALUES('Date'[Format Month]),[Sum Sales]),DATESINPERIOD('Date'[Date Filer],ENDOFMONTH(Sales[Sales Date]),-12,MONTH))
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks.
My Recent Blog - https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601
I was able to get all the fields as columns in my Summary Table. Now i just need to figure how to calculate a rolling MEDIAN of prev 12m of % Change.
MMM_YYYY | Total | Prev_Month | Change | % Change |
12 before 12
Rolling 12 Median before 12 = CALCULATE(MEDIANX(VALUES('Date'[Format Month]),[Sum Sales]),DATESINPERIOD('Date'[Date Filer],ENDOFMONTH(dateadd(Sales[Sales Date],-12,month)),-12,MONTH))
Why are you creating a measure for the sum of sales? I am trying to determine the % Change? what is "Date filer"
Rolling 12 Median before 12 = CALCULATE(MEDIANX(VALUES('Date'[Format Month]),[Sum Sales]),DATESINPERIOD('Date'[Date Filer],ENDOFMONTH(dateadd(Sales[Sales Date],-12,month)),-12,MONTH))
Change % will not have date. It should be like
(Rolling 12 Median -Rolling 12 Median before 12 )/(Rolling 12 Median before 12 )*100
((Current - Prior)/Prior)*100
Now that I have everything as a column in my Summary table. I think this might work for me.
Hi @Jorgast
It should be correct, except it returns median of 2018/12-2019/11 for the row 2019/11.
You could use the column to return median of 2018/11-2019/10 for the row 2019/11,
c =
CALCULATE (
MEDIAN ( [change%] ),
DATESINPERIOD ( 'date'[Date], EOMONTH ( MAX ( 'date'[Date] ), -1 ), -12, MONTH )
)
If you have any problem, please feel free to let me know.
When I use that measure I get 0.60% for every month. It looks like the measure is trying to get the Median value for the entire data column of % Change. I need the Median value to be a rolling 12 months of historical % Change data.
Actually you need to test that
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
100 | |
78 | |
75 | |
50 |
User | Count |
---|---|
144 | |
109 | |
108 | |
87 | |
61 |