Forum Discussion

dommyw277's avatar
dommyw277
Helper V
3 years ago
Solved

Difference Monthly

Hi,

I would like to add a column to show difference per month in cost and percentage for just 2023?
I have a column called Date_Month and amount. Thanks

  • Amount diff MoM = 
    	VAR __PREV_MONTH =
    		CALCULATE(
    			SELECTEDVALUE('Table'[amount]),
    			DATEADD('Table'[Date_Month], -1, MONTH)
    		)
    	RETURN
    		SELECTEDVALUE('Table'[amount]) - __PREV_MONTH

     

    Amount MoM% = 
    	VAR __PREV_MONTH =
    		CALCULATE(
    			SELECTEDVALUE('Table'[amount]),
    			DATEADD('Table'[Date_Month], -1, MONTH)
    		)
    	RETURN
    		DIVIDE(SELECTEDVALUE('Table'[amount]) - __PREV_MONTH, __PREV_MONTH)


    make sure the date_month is date format, replace table with you table name

1 Reply

  • Amount diff MoM = 
    	VAR __PREV_MONTH =
    		CALCULATE(
    			SELECTEDVALUE('Table'[amount]),
    			DATEADD('Table'[Date_Month], -1, MONTH)
    		)
    	RETURN
    		SELECTEDVALUE('Table'[amount]) - __PREV_MONTH

     

    Amount MoM% = 
    	VAR __PREV_MONTH =
    		CALCULATE(
    			SELECTEDVALUE('Table'[amount]),
    			DATEADD('Table'[Date_Month], -1, MONTH)
    		)
    	RETURN
    		DIVIDE(SELECTEDVALUE('Table'[amount]) - __PREV_MONTH, __PREV_MONTH)


    make sure the date_month is date format, replace table with you table name