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,
Im looking for the formula which can return MoM sales based on MTD number of days.
for exampls If today 09-Aug, I would like to see sum of sales previous month to date 09-Jul.
Data model simple Sales volume table <-> Date Callendar
Solved! Go to Solution.
Hi @slyfox,
Based on my test, we can take the following steps to meet your requirement.
1.Enter the data and create relationship between Sales volume table and Date Callendar table.
2.create a measure as below to get the excepted result.
pre = var dat = SELECTEDVALUE('Date Callendar'[Date]) return IF(ISFILTERED('Date Callendar'[Date]),IF(MONTH(dat)=1,CALCULATE(SUM('Sales volume'[sales]),FILTER(ALL('Sales volume'), DATE(YEAR(dat)-1,12,1)<='Sales volume'[date] && 'Sales volume'[date] <=DATE(YEAR(dat)-1,12,DAY(dat)))),CALCULATE(SUM('Sales volume'[sales]),FILTER(ALL('Sales volume'), DATE(YEAR(dat),MONTH(dat)-1,1)<='Sales volume'[date] && 'Sales volume'[date] <=DATE(YEAR(dat),MONTH(dat)-1,DAY(dat))))),BLANK())
For more details, please check the pbix as attached. If it doesn’t meet your requirement, kindly share me sample data of your table and tell me what is your excepted result.
https://www.dropbox.com/s/kwrf61knwqjbe0q/MoM%20sales%20volume%202.pbix?dl=0
Regards,
Frank
Hi @slyfox,
Based on my test, we can take the following steps to meet your requirement.
1.Enter the data and create relationship between Sales volume table and Date Callendar table.
2.create a measure as below to get the excepted result.
pre = var dat = SELECTEDVALUE('Date Callendar'[Date]) return IF(ISFILTERED('Date Callendar'[Date]),IF(MONTH(dat)=1,CALCULATE(SUM('Sales volume'[sales]),FILTER(ALL('Sales volume'), DATE(YEAR(dat)-1,12,1)<='Sales volume'[date] && 'Sales volume'[date] <=DATE(YEAR(dat)-1,12,DAY(dat)))),CALCULATE(SUM('Sales volume'[sales]),FILTER(ALL('Sales volume'), DATE(YEAR(dat),MONTH(dat)-1,1)<='Sales volume'[date] && 'Sales volume'[date] <=DATE(YEAR(dat),MONTH(dat)-1,DAY(dat))))),BLANK())
For more details, please check the pbix as attached. If it doesn’t meet your requirement, kindly share me sample data of your table and tell me what is your excepted result.
https://www.dropbox.com/s/kwrf61knwqjbe0q/MoM%20sales%20volume%202.pbix?dl=0
Regards,
Frank
Hi @slyfox,
Does that make sense? If so, kindly mark my answer as a solution to close the case please.
Regards,
Frank
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 |
---|---|
108 | |
100 | |
78 | |
64 | |
58 |
User | Count |
---|---|
148 | |
111 | |
94 | |
84 | |
67 |