Forum Discussion
Link date_start and date_end to calender table
In a matrix I want to count all id's per month and year that are between date_start and date_end.
So when date_start is 2023/08/23 and date_end is 2023/11/15 than august should count 1, sept should could 1, oct should count one and nov should count one.
Chatgtp told met to link both date_start and date_end to the same date field in a calender table. However I don't get the correct result. Only august counts 1.
How to solve this ?
I am sure more members had this question, but I cannot find a correct answer.
2 Replies
- Greg_Deckler
Community Champion
noobtopowerbi
Take a look at these two Quick Measures as I think you want something like them.
https://community.powerbi.com/t5/Quick-Measures-Gallery/Open-Tickets/m-p/409364
https://community.powerbi.com/t5/Quick-Measures-Gallery/Periodic-Billing/m-p/409365Hard to be specific without knowing your data. If we are just talking about a Dates table or something, then here's a guess:
Measure = VAR __MinDate = MIN('Table'[Date]) VAR __MaxDate = MAX('Table'[Date]) VAR __Table = ADDCOLUMNS( FILTER( 'Table', [Date] >= __MinDate && [Date] <= __MaxDate ), "__Month", MONTH( [Date]) ) VAR __Table1 = SUMMARIZE( __Table, [__Month] ) VAR __Result = COUNTROWS( __Table1 ) RETURN __Result - AnonymousNot applicable
Hi noobtopowerbi ,
Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.
If these also don't help, please share more detailed information and description to help us clarify your scenario to test.
How to Get Your Question Answered Quickly
Regards,
Xiaoxin Sheng