Forum Discussion
hstgeorge
1 year agoHelper III
Help with a Dax Formula
I am trying to create a formula that will show the variance month over month of the values in my table: Month Jan Feb Mar Expenses 1000 2500 ...
- 1 year ago
Is the table your raw data format or the table visual?
If it's your raw data,
1. select the first column and unpivot other columns in PQ
2. create a new column
3. change the type to date
4. use DAX to create a column
Column =var _last=maxx(FILTER('Table','Table'[Month]=EARLIER('Table'[Month])&&'Table'[Custom]=EDATE(EARLIER('Table'[Custom]),-1)),'Table'[Value])return if (ISBLANK(_last),BLANK(),'Table'[Value]-_last)pls see the attachment below
hnguy71
1 year agoSuper User
Hi hstgeorge
You would have to create a series of measures. Start with a base measure to return your total value such as this:
Base Total = SUM('Table'[Value])
Then create a measure to find out your previous months' value:
Previous Total = CALCULATE([Base Total], DATEADD('Table'[Period], -1, MONTH))
and finally, subtract the two with another measure:
Variance MoM = [Base Total] - [Previous Total]
Hopefully you should get a result similar to this: