Forum Discussion
Joshua_
5 years agoHelper II
Help with the date filter
Hi Guys,
I need to calculate the sales per month between 2 dates, I created in the calendar table two columns with the maximum date and the minimum date, I also created a measure with the datebetween function with the dates but the result is the accumulated sales and it should be shown per month .
measure Saldo=
VAR INI = SELECTEDVALUE(CALENDARIO[INICIO_HISTORICO])
VAR FIN = SELECTEDVALUE(CALENDARIO[FIN_HISTORICO])
RETURN
CALCULATE(
[Saldo_Prom],
DATESBETWEEN(CALENDARIO[Date],INI,FIN)
)
any suggestions, thanks guys.
Does it do what you expect if you use KEEPFILTERS to prevent DATESBETWEEN from overriding the month?
Saldo = VAR INI = SELECTEDVALUE ( CALENDARIO[INICIO_HISTORICO] ) VAR FIN = SELECTEDVALUE ( CALENDARIO[FIN_HISTORICO] ) RETURN CALCULATE ( [Saldo_Prom], KEEPFILTERS ( DATESBETWEEN ( CALENDARIO[Date], INI, FIN ) ) )
2 Replies
- AlexisOlsonSuper User
Does it do what you expect if you use KEEPFILTERS to prevent DATESBETWEEN from overriding the month?
Saldo = VAR INI = SELECTEDVALUE ( CALENDARIO[INICIO_HISTORICO] ) VAR FIN = SELECTEDVALUE ( CALENDARIO[FIN_HISTORICO] ) RETURN CALCULATE ( [Saldo_Prom], KEEPFILTERS ( DATESBETWEEN ( CALENDARIO[Date], INI, FIN ) ) )- Joshua_Helper II
It was just what I needed, thank you very much AlexisOlson