Forum Discussion
kasife
3 years agoHelper V
Comparing months with the same selected period
Hi people,
I'm having a little trouble getting the following result: I'd like to get the amount of leads for the current month, the previous month and the month before the previous one according to the period I select. I want to know what was the amount in the same period in these 3 months. How could I do this?
Here is the result I would like to get,
I am using the following measure and it is not working
var atual = CALCULATE(DISTINCTCOUNT(_leads[Id]),_leads[Produtos com nome do Reaal]<>BLANK())
var delta = DATEDIFF(max(d_calendario[Date]), min(d_calendario[Date]), MONTH)
RETURN
CALCULATE(
atual,
DATEADD(d_calendario_aux[Date],delta-1, MONTH)
)
Here is my PBIX attached:
Hi
DATEADD is meant to give the result in the selected date slicer. use these 3 dax
atual = CALCULATE(DISTINCTCOUNT(_leads[Id]),_leads[Produtos com nome do Reaal]<>BLANK())Atual -1 = CALCULATE([atual] , DATEADD(d_calendario[Date] , -1 , MONTH))Atual -2 = CALCULATE([atual] , DATEADD(d_calendario[Date] , -2 , MONTH))
5 Replies
- aj1973Community Champion
- aj1973Community Champion
Hi
DATEADD is meant to give the result in the selected date slicer. use these 3 dax
atual = CALCULATE(DISTINCTCOUNT(_leads[Id]),_leads[Produtos com nome do Reaal]<>BLANK())Atual -1 = CALCULATE([atual] , DATEADD(d_calendario[Date] , -1 , MONTH))Atual -2 = CALCULATE([atual] , DATEADD(d_calendario[Date] , -2 , MONTH))