Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hello Team,
I need your help in writing a measure for calculating daily count of items.
Here's the sample data
| Item | Opendate | Closeddate |
| A | 7/20/2020 | 7/22/2020 |
| B | 7/20/2020 | 7/20/2020 |
| C | 7/21/2020 | 7/27/2020 |
I need to create virtual table like this and get result from this below table
| Item | Opendate | Closeddate |
| A | 7/20/2020 | 7/22/2020 |
| A | 7/21/2020 | 7/22/2020 |
| A | 7/22/2020 | 7/22/2020 |
| B | 7/20/2020 | 7/20/2020 |
| C | 7/21/2020 | 7/27/2020 |
| C | 7/22/2020 | 7/27/2020 |
| C | 7/23/2020 | 7/27/2020 |
| C | 7/24/2020 | 7/27/2020 |
| C | 7/25/2020 | 7/27/2020 |
| C | 7/26/2020 | 7/27/2020 |
| C | 7/27/2020 | 7/27/2020 |
In the above table i need to add dates for Item until its closed.
So, the measure has to calculate distinct count of items in each opendate.
Resultset or measure value(Distinct count on each opendate)
| Opendate | distinctcount of items |
| 7/20/2020 | 2 |
| 7/21/2020 | 2 |
| 7/22/2020 | 2 |
| 7/23/2020 | 1 |
| 7/24/2020 | 1 |
| 7/25/2020 | 1 |
| 7/26/2020 | 1 |
| 7/27/2020 | 1 |
Please suggest me DAX measure to achieve this,
Thank you.
@Anonymous ,
Check if this file can help
https://www.dropbox.com/s/bqbei7b8qbq5xez/leavebetweendates.pbix?dl=0
Thank you @amitchandak for your response.
But the count seems to be incorrect in my case.
| Item | Opendate | Closeddate | Category | code |
| A | 7/20/2020 | 7/22/2020 | sales | x |
| A | 7/21/2020 | 7/22/2020 | sales | x |
| A | 7/22/2020 | 7/22/2020 | sales | x |
| B | 7/20/2020 | 7/20/2020 | Purchase | y |
| C | 7/21/2020 | 7/27/2020 | purchase | y |
| C | 7/22/2020 | 7/27/2020 | purchase | x |
| C | 7/23/2020 | 7/27/2020 | purchase | x |
| C | 7/24/2020 | 7/27/2020 | purchase | x |
| C | 7/25/2020 | 7/27/2020 | purchase | x |
| C | 7/26/2020 | 7/27/2020 | purchase | y |
| C | 7/27/2020 | 7/27/2020 | purchase | y |
But I forgot to mention if "closed date" is null, add date to opendate until the item is closed and also get the distintinct count by including category column while summarizing.
Please let me know your suggestions.!
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 11 | |
| 9 | |
| 9 | |
| 5 | |
| 4 |
| User | Count |
|---|---|
| 27 | |
| 22 | |
| 20 | |
| 17 | |
| 12 |