Forum Discussion

LCarenzo's avatar
LCarenzo
Helper I
3 years ago
Solved

Divide....

I am stuck.  I have the following columns:

 

Month

Value

Category

 

I am trying to take last months value and subtract it from this months value - I want to be able to sort it by the category.  Basically I am looking for the month over month difference, but the issue is my month is in the same column.

 

How can I set this up to properly show the difference?

 

Thanks in advance.

 

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi LCarenzo,

    Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.

    If these also don't help, please share more detailed information and description to help us clarify your scenario to test.

    How to Get Your Question Answered Quickly 

    Regards,

    Xiaoxin Sheng

  • VAR currentMonth = [Month]
    VAR currentvalue = [Value]
    VAR perviousmonthvalue = CALCULATE(
                                                                MAX([Value]), FILTER(ALL('TableName'),
                                                                                                   [Category] = EARLIER([Category], 
                                                                                                    [Month] <currentMonth
                                                                                                   )
                                                                                  currentvalue - perviousmonthvalue          
                                                            )