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

Percentage difference in sales between months but till the day of today

I want to find the difference in sales between months but till the day of today. I wrote the measures below. Sales_till_day measure works. But when I want to find percentage differences, it doesn’t work, however, any error doesn't appear.

sales_till_day = CALCULATE([total sales];FILTER(Table;DAY('Table'[Date])<=DAY([today]));DATESINPERIOD('Table[Date];STARTOFMONTH('Table'[Date]);DAY([today]);DAY))

 

sales_till_day% =

VAR monthesbefore = CALCULATE(([sales_till_day]);FILTER('Table';MONTH('Table'[Date])<MONTH[today]))

VAR currentmonth = CALCULATE(([sales_till_day]);FILTER('Table';MONTH('Table'[Date])=MONTH[today]))

return

currentmonth/ monthesbefore

 

After the measures above, I tried to write different DAX with the name MTD. But the result was the same as previous

 

MTD= CALCULATE(TOTALMTD([total sales];'Table'[Date];FILTER('Table';Day('Table' [Date])<=day([today]))))

 

mtd% =

VAR monthesbefore = CALCULATE(TOTALMTD([total sales]);'Table'[Date];FILTER('Table';Day('Table' [Date])<=day([today])); FILTER('Table';MONTH('Table'[Date])<MONTH[today]))
VAR currentmonth = CALCULATE(TOTALMTD([total sales]);'Table'[Date];FILTER('Table';Day('Table' [Date])<=day([today])); FILTER('Table';MONTH('Table'[Date])=MONTH[today]))

Even I tried this

VAR MTD= CALCULATE(TOTALMTD([total sales];'Table'[Date];FILTER('Table';Day('Table' [Date])<=day([today]))))
return

IF([MTD]=0;0;DIVIDE(CALCULATE([MTD];'Table'[Date].[Year]=2019);[mtd])-1)

0 REPLIES 0

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