Forum Discussion
CG12
7 years agoFrequent Visitor
Filter by Current Month and Last Month using Calculated Column
Hi Folks, This has been a headscratacher for me. Basically I am trying to get a frequency count of a particular column from another table but only from within a particular month (kind of dynamic)...
- 7 years ago
Hello CG12
Your best bet in the time intelligent function DATESINPERIOD. You will need a date table but then your calculation is just something like:
3 MO Prospect = VAR EndingDate = MAX ( Dates[Date] ) RETURN CALCULATE( [Prospect], DATESINPERIOD(Dates[Date],EndingDate,-3,MONTH) )
Could you maybe share a sample of your data model if the above doesn't work for you?
jdbuchanan71
7 years agoSuper User
Hello CG12
Your best bet in the time intelligent function DATESINPERIOD. You will need a date table but then your calculation is just something like:
3 MO Prospect =
VAR EndingDate = MAX ( Dates[Date] )
RETURN
CALCULATE(
[Prospect],
DATESINPERIOD(Dates[Date],EndingDate,-3,MONTH)
)
Could you maybe share a sample of your data model if the above doesn't work for you?