Forum Discussion
Tormod_GK
10 years agoFrequent Visitor
Calculate difference from previous month
Hi. I have a table where I need to subtract two values which are from different rows. I want the difference between the value for the current date in the row and from the row which has the previo...
- 10 years ago
In this scenario, since you need to get the previous month data based on current slicing date, it's better to create a measure instead of a calculated column. Otherwise, you have to lookup previous row based on index column as ankitpatira suggested. Just create a measure like:
difference= sum(DW_Data_Salg[Inntekt])-CALCULATE(SUM(DW_Data_Salg[Inntekt]),PARALLELPERIOD(DW_Data_Salg[DATO].[Date],-1,MONTH))
Or
difference= sum(DW_Data_Salg[Inntekt])-CALCULATE(SUM(DW_Data_Salg[Inntekt]),PREVIOUSMONTH(DW_Data_Salg[DATO].[Date]))
Regards,
SN1703
3 years agoNew Member
Hi, could anyone please guide me as to how to get %difference of previous month ? I am getting blanks for months not required in the report , have to hide these blank columns , very taxing .
I am using the following DAX impression -
MID MoM% =
VAR __PREV_MONTH =
CALCULATE(
DISTINCTCOUNT('Append1'[Merchant Id]),
DATEADD('Date'[Date],-1, MONTH)
)
RETURN
DIVIDE(
DISTINCTCOUNT('Append1'[Merchant Id]) - __PREV_MONTH,
__PREV_MONTH
)
Also attaching the screenshot , would appreciate if someone can help me on this please, I only require previous