Forum Discussion

Vivicloser's avatar
Vivicloser
Regular Visitor
4 years ago
Solved

Variation between 2 or more months

Good afternoon everyone (:  I have a question, if anyone has an idea of how to solve it, I would be very grateful!
The calculation of "Variação" results when we select only 2 months. When we select more than two months, it only calculates the variation between the last and the first month, and ignores the rest. What is desired is that, for example, a value for the variation between July and September appears, and a value for the variation between September and November. How else could I write the Delta expression when selecting more than 2 months?

Variação =

VAR Valor1 = CALCULATE ('Selecao de medidas'[Key_Operation], 'Data_M'[Data] = Min('Data_M'[Data]))

VAR Valor2 = CALCULATE ('Selecao de medidas'[Key_Operation], 'Data_M'[Data] = Max('Data_M'[Data]))

VAR Diferenca = Valor2 - Valor1

VAR Resultado = DIVIDE (Diferenca, Valor1) *100

RETURN Resultado

 

The Key_Operation measure referred to in the Variation is as follows:

Key_Operation = SWITCH(TRUE(),

'Selecao de medidas'[Select_Operation] = "Closed Act.", [Closed Activities],

'Selecao de medidas'[Select_Operation] = "Interactions", PeriodType[Interactions],

'Selecao de medidas'[Select_Operation] = "Distinct Users", PeriodType[Distinct Users],

'Selecao de medidas'[Select_Operation] = "AVG TMT(seg)", PeriodType[AVG TMT(seg)])

4 Replies