Forum Discussion
ID Count per each calendar date
Hi everyone,
I have the following issue that I need your help to solve.
the following is an example of the dataset I have:
| Membership_id | Start_Date | End_Date |
| m1 | July 1, 2023 | July 5, 2023 |
| m2 | July 5, 2023 | July 9, 2023 |
| m3 | July 4, 2023 | July 7, 2023 |
my goal is to get the count of membership_id per day like the example below:
| Date | Count of Memberships |
| July 1, 2023 | 1 |
| July 2, 2023 | 1 |
| July 3, 2023 | 1 |
| July 4, 2023 | 2 |
| July 5, 2023 | 3 |
| July 6, 2023 | 2 |
| July 7, 2023 | 2 |
| July 8, 2023 | 1 |
| July 9, 2023 | 1 |
in SQL, I can to join the first table with the calendar table and get the following results:
SELECT *
FROM First_Table t
LEFT OUTER JOIN Calendar c ON c.date >= t.Start_Date AND c.dt_dt <= t.End_Date
I could import the results to PowerBi and and count the memberships per day. however, the SQL query generates a huge amount of records which causing issues due to the restrictions we have.
| Dates | Membership_id |
| July 1, 2023 | m1 |
| July 2, 2023 | m1 |
| July 3, 2023 | m1 |
| July 4, 2023 | m1 |
| July 5, 2023 | m1 |
| July 5, 2023 | m2 |
| July 6, 2023 | m2 |
| July 7, 2023 | m2 |
| July 8, 2023 | m2 |
| July 9, 2023 | m2 |
| July 4, 2023 | m3 |
| July 5, 2023 | m3 |
| July 6, 2023 | m3 |
| July 7, 2023 | m3 |
I hope there's a way to achieve that in PowerBi.
Thanks
KamilGH
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/409365
2 Replies
- Greg_Deckler
Community Champion
KamilGH
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/409365 - KamilGHFrequent Visitor
Thank you Greg_Deckler these two examples are helpful.