Month over Month calculating incorrect

I have the following measures, but my Last Months in the current months context doesn’t match the previous month. What am I doing wrong?

RMA Count (#) = 
CALCULATE(
    //DISTINCTCOUNT('Transaction Lines'[Transaction Internal ID]),
    SUM('Transaction Lines'[Quantity]),
    'Transaction Lines'[Type]="return authorization"
)*-1

RMA Count (#) (LM) = 
VAR sliceByDate = SELECTCOLUMNS('Transaction Date', "prevMonth", 'Transaction Date'[Calendar DatePreviousMonth])
RETURN
CALCULATE(
    [RMA Count (#)],
    TREATAS(sliceByDate, 'Transaction Date'[*Date (trans)])
)

RMA Count (MoM) = 
[RMA Count (#)] - [RMA Count (#) (LM)]

image

Hi @Usates,

Without the sample file it is hard to just work with the given DAX code could you please help to upload the sample file.

Thanks
Mukesh

1 Like

@Usates Couple of things missing here, you are not using time intelligence functions to shift dates back, and you need to include Year and Dates column as well for getting previous month’s value.

1 Like

Hi @Usates, we aim to consistently improve the topics being posted on the forum to help you in getting a strong solution faster. While waiting for a response, here are some tips so you can get the most out of the forum and other Enterprise DNA resources.

  • Use the forum search to discover if your query has been asked before by another member.

  • When posting a topic with formula make sure that it is correctly formatted to preformatted text </>. image

  • Use the proper category that best describes your topic

  • Provide as much context to a question as possible.

  • Include the masked demo pbix file, images of the entire scenario you are dealing with, screenshot of the data model, details of how you want to visualize a result, and any other supporting links and details.

I also suggest that you check the forum guideline How To Use The Enterprise DNA Support Forum. Not adhering to it may sometimes cause delay in getting an answer.

Please also check the How To Mask Sensitive Data thread for some tips on how to mask your pbix file.