The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event! Join us in Stockholm, Sweden from September 24-27, 2024.
2-for-1 sale on June 20 only!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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.
@sree_12 ,
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.!
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the June 2024 Power BI update to learn about new features.
User | Count |
---|---|
67 | |
34 | |
21 | |
18 | |
15 |
User | Count |
---|---|
124 | |
39 | |
30 | |
24 | |
22 |