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.
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)
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 |
---|---|
42 | |
21 | |
21 | |
14 | |
13 |
User | Count |
---|---|
43 | |
39 | |
33 | |
18 | |
17 |