cancel
Showing results for
Did you mean:
Post Prodigy

## Compare Jan 20 with Jan 21 data and work out Percentage Difference

Hi Experts

I want a new measure which i cannot work out on how to calculate the

Percentage Difference

Jan 2020 (441) - Jan 2021 (685) week on week comparison

and so on for all the months - the sample PBIX file show a measure for month over month difference. Kinldy ignore that i managed to do that.

See sample PBIX file.

1 ACCEPTED SOLUTION
Super User IV

@Route217 , Try like

``````total sales same week# previous month =
var _max = Max(DimDate[Date])
var _date = date(year(_max), month(_max)-12, Day(_max))
VAR currentyear = Year(_date)
VAR currentmonth = Month(_date)
VAR currentweeknumber = MAX(DimDate[weekinmonth])
RETURN
CALCULATE([total sales], FILTER( ALL(DimDate), DimDate[Year] = currentyear && DimDate[MonthNo] = currentmonth  && DimDate[weekinmonth] = currentweeknumber))``````

Also be careful on sort order, as you might not have prior data for 1 year. I got confused and done some reordeing

Proud to be a Super User!

2 REPLIES 2
Super User IV

@Route217 , Try like

``````total sales same week# previous month =
var _max = Max(DimDate[Date])
var _date = date(year(_max), month(_max)-12, Day(_max))
VAR currentyear = Year(_date)
VAR currentmonth = Month(_date)
VAR currentweeknumber = MAX(DimDate[weekinmonth])
RETURN
CALCULATE([total sales], FILTER( ALL(DimDate), DimDate[Year] = currentyear && DimDate[MonthNo] = currentmonth  && DimDate[weekinmonth] = currentweeknumber))``````

Also be careful on sort order, as you might not have prior data for 1 year. I got confused and done some reordeing

Proud to be a Super User!

Post Prodigy

Thank you sir

Announcements