Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I have a list of services with IDs that have an open date and a closed date on the same record line in a table. They look like so:
ID | Opened Date | Closed Date |
1 | 10/22/2019 | 11/4/2019 |
2 | 11/4/2019 | 11/4/2019 |
3 | 11/4/2019 | 11/6/2019 |
4 | 11/5/2019 | 11/7/2019 |
5 | 11/7/2019 | 11/12/2019 |
6 | 11/8/2019 | 12/17/2019 |
7 | 11/13/2019 | |
8 | 11/13/2019 | |
9 | 11/19/2019 | 1/3/2020 |
I've created a Calendar table with an Active Relationship from the Date column to Opened Date column in my dataset, as the majority of sorting I'll do with the expanded dataset uses that column.
If I wanted to take a look at all the services that were opened (created) in the month of November, I'd set my slicer from the Calendar table with a minimum date of 11/1/2019 and a maximum date of 11/30/2019 then create a Measure:
This gives me a total of 8, which is great! When I took specifically at the data to validate, I like what I see:
ID | Opened Date | Closed Date |
2 | 11/4/2019 | 11/4/2019 |
3 | 11/4/2019 | 11/6/2019 |
4 | 11/5/2019 | 11/7/2019 |
5 | 11/7/2019 | 11/12/2019 |
6 | 11/8/2019 | 12/17/2019 |
7 | 11/13/2019 | |
8 | 11/13/2019 | |
9 | 11/19/2019 | 1/3/2020 |
Now I want to see the services that were CLOSED in the month of November. Similar counting methodology, but within a given date range with the Closed Date column. Since the Calendar table already has an active relationship with the Opened Date column, I create an inactive relationship to the Closed Date column with the Date column from the Calendar table, and then use the USERELATIONSHIP function within a CALCULATE function to do a similar count:
Count of Closed Cases = CALCULATE(COUNTROWS(ID), USERELATIONSHIP(Services[Closed Date],'Calendar'[Date]))
The expected total I should get is 5, as these should be the services that come up:
ID | Opened Date | Closed Date |
1 | 10/22/2019 | 11/4/2019 |
2 | 11/4/2019 | 11/4/2019 |
3 | 11/4/2019 | 11/6/2019 |
4 | 11/5/2019 | 11/7/2019 |
5 | 11/7/2019 | 11/12/2019 |
However, when I display my count, it's 8, the same as my Count of Opened Cases measure, and the list that remains is the same one as the Opened Date cases.
My guess is the date slicer always defaults to the Opened Date column regardless of the measures I've made? Can anyone provide any guidance on how to move forward?
Solved! Go to Solution.
Hi @Anonymous,
you need to count the Facttable "Services" and not on a Dimensiontable "ID".
You may download my PBIX file from here.
Hope this helps.
Regards,
Marcus
Dortmund - Germany
If I answered your question, please mark my post as solution, this will also help others.
Please give Kudos for support.
Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials
Hi,
Ensure that there is an inactive relationship between the Closed Date column of your Data Table to the Date column of your Calendar Table.
Hi @Anonymous,
you need to count the Facttable "Services" and not on a Dimensiontable "ID".
You may download my PBIX file from here.
Hope this helps.
Regards,
Marcus
Dortmund - Germany
If I answered your question, please mark my post as solution, this will also help others.
Please give Kudos for support.
Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials
Refer, if this can help
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
https://community.powerbi.com/t5/Community-Blog/Winner-Topper-on-Map-How-to-Color-States-on-a-Map-wi...
https://community.powerbi.com/t5/Community-Blog/Power-BI-Working-with-Non-Standard-Time-Periods/ba-p...
https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
77 | |
74 | |
57 | |
40 | |
35 |
User | Count |
---|---|
65 | |
65 | |
59 | |
53 | |
45 |