Forum Discussion
Need help with a count measure
Hi, I want a graph with the total number of dogs in my kennel each month. The issue I’m running into is that I’m using the Start_Date on the X axis, this is only giving me dogs that started in that month and not a total of dogs in the kennels at that time.
For example, I need it to show the total number of dogs receiving support per month:
March = 3 dogs were in our kennels
June = 4 dogs were in the kennels
August = 3 dogs were in the kennels
| Dog | Start_Date | End_Date | Support_Status |
| Max | 01/01/2024 | Open | |
| Molly | 01/02/2024 | Open | |
| Alba | 01/03/2024 | 15/06/2024 | Closed |
| Chester | 01/04/2024 | 10/07/2024 | Closed |
| Birdie | 01/08/2024 | Open |
What measure would show the total number of dogs being supported in each month please?
Thanks
Make sure that you have a date table, there's plenty of articles and videos on creating a proper date table.
You can then use columns from your date table in the visuals, and create a measure like
Dogs per month = VAR MaxDate = MAX ( 'Date'[Date] ) VAR Result = CALCULATE ( COUNTROWS ( 'Table' ), 'Table'[Start Date] <= MaxDate && ( 'Table'[End Date] > MaxDate || ISBLANK ( 'Table'[End Date] ) ), REMOVEFILTERS ( 'Date' ) ) RETURN Result
4 Replies
- johnt75
Super User
Make sure that you have a date table, there's plenty of articles and videos on creating a proper date table.
You can then use columns from your date table in the visuals, and create a measure like
Dogs per month = VAR MaxDate = MAX ( 'Date'[Date] ) VAR Result = CALCULATE ( COUNTROWS ( 'Table' ), 'Table'[Start Date] <= MaxDate && ( 'Table'[End Date] > MaxDate || ISBLANK ( 'Table'[End Date] ) ), REMOVEFILTERS ( 'Date' ) ) RETURN Result - RichOB
Post Partisan
Hi johnt75 , thanks for your measure. I've watched some videos on YouTube, but have an issue.
I've made a calendarauto table. If I make the relationship join from the calendar table to the start date, it only gives me the count of dogs that started on those dates (as it should), whereas I want the count per month of all dogs active within the months between when they start and the end date. What am I doing wrong here, please?
Thanks
- johnt75
Super User
Make sure that your measure has the REMOVEFILTERS( 'Date' ) in it.
- v-karpurapud
Community Support