Forum Discussion
How to count months in filter?
Hello.
I have a filter from the calendar table.
I need to calculate the number of months between the start date and the end date of the filter. How can i do this? Thanks in advance for answers
add a measure
number of months = DATEDIFF(Min(Calendar[Date]) MAX(Calendar[Date]), Month)
4 Replies
- parry2k
Super User
add a measure
number of months = DATEDIFF(Min(Calendar[Date]) MAX(Calendar[Date]), Month)
- PalexRFRegular Visitor
Thank you for an answer.
I used this construction. But it returns all dates in calendar table. But i need only filtered dates.
ex. I have calendar table with dates from 2010 to 2017. And i set filter on sheet only for 2016 year. So i need to get 12 months in result. But your formula will return all months from 2010 to 2017.
- parry2k
Super User
I just test the same thing at my end and it worked as expected. Not sure what else is going on at your end? Any relationship with other table or something else is making it not to work, one improvment I need to do in my formulat is to add one to it, that will be give true number.