Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Anonymous
Not applicable

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.

https://www.dropbox.com/s/g50upe7c0uxozlb/Mtnovermtn.pbix?dl=0 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , 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

 

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , 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

 

Anonymous
Not applicable

Thank you sir

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors