Forum Discussion
mmakhlo
9 years agoFrequent Visitor
Calculate difference from previous month
Hello! I would like to display the difference in cost by month. This is the current table I have. It shows cost by year-moth by site. I would like to show the difference in cost each month in ano...
Anonymous
9 years agoNot applicable
Hi mmakhlo,
You can try to use below measure to get the diff of current date and previous month.
Diff of Previous Month =
var currSite=MAX([Site])
var currDate=MAX([Date])
return
SUMX(FILTER(ALL('Sample'),[Site]=currSite&&FORMAT([Date],"yyyy-mm")=FORMAT(currDate,"yyyy-mm")),[Amount])-SUMX(FILTER(ALL('Sample'),[Site]=currSite&&FORMAT([Date],"yyyy-mm")=FORMAT(DATE(YEAR(currDate),MONTH(currDate)-1,DAY(currDate)),"yyyy-mm")),[Amount])
Regards,
Xiaoxin Sheng