Forum Discussion

bramos88's avatar
bramos88
Frequent Visitor
8 years ago

Calculating Variables with Different Months

Hi!

 

I need to create a measure where I divide the sum of two values, with one month difference between them and both being qualified by another variable. Something like this:

SUM(Consulta1[B] HAVING C = 'C 31-60')
            /
         SUM(Consulta1[A] HAVING C = 'A 000' AND MONTH = Consulta1[B].MONTH - 1)

Here is a picture of the data with the idea of the calculation:

 

Can someone help me with that?

 

Thanks!

3 Replies

      • v-juanli-msft's avatar
        v-juanli-msft
        Community Support

        Hi

        You could modify formula in measure as below

        MEASURE =
        DIVIDE (
            CALCULATE ( SUM ( [B] )FILTER ( ALL ( consultal )MAX ( [c] ) = "C31-60" ) ),
            CALCULATE ( SUM ( [A] )FILTER ( ALL ( consultal )MAX ( [C] ) = "A 000" ) )
        )

        The formalu above lack the condition of something about month since i don't understand about “one month difference between them”, what does this mean?

         

        Best Regards

        Maggie