Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Mark_Berry
Helper I
Helper I

How to Count Indiviudal Date Occurances

Have a data set that contains both first date opened and last date closed for a series of enquires.
These columns are formated as DD-MMM-YY. 

I am attempting to measure how many enquires are opened and closed per month, however when I attempt to count/distinct count the dates by month and year I get incorrect counts, as an example I have 10 enquires opened during January 4 of which are duplicate dates yet I recieve a result of 8 from Power BI, so I am unsure as to what specific enquires are being missed. 



1 ACCEPTED SOLUTION

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1706673255425.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

8 REPLIES 8
Ashish_Mathur
Super User
Super User

Hi,

Share data in a format that can be pasted in an MS Excel file.  Show the expected result as well.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

 

ReferenceDate First OpenedDate Last Closed
10016/09/202209-Dec-22
10119/09/202224-Oct-23
10220/09/202231-Jan-23
10321/09/202224-Oct-23
10421/09/202203-Feb-23
10521/09/202206-Dec-22
10628/09/202218-Nov-22
1074/10/202220-Dec-22
1084/10/202218-Nov-22
1096/10/202208-Jun-23
11010/10/202206-Dec-22
11110/10/202206-Dec-22
11213/10/202221-Mar-23
11318/10/202216-Jan-23
11418/10/202218-Nov-22
11527/10/202212-Jan-24
11628/10/202213-Sep-23
11714/11/202209-Dec-22
11815/11/202202-Feb-23
11915/11/202209-Dec-22
12018/11/202201-Mar-23
12122/11/2022 
12222/11/2022 
12330/11/202205-Apr-23
1246/12/202209-Dec-22
1258/12/202208-Jun-23
1268/12/202217-Jan-23
12714/12/202216-Dec-22
12814/12/202214-Dec-22
12916/12/2022 
13016/12/202222-Dec-22
13119/12/202215-Aug-23
13220/12/202203-Feb-23

Mark_Berry_0-1706672392777.png

I expect the above visualisation to show the count of references to show how many were opened each month and how many were closed each month. 

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1706673255425.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thanks

Hi,

Based on the table that you have shared, show the expected result very clearly.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
amustafa
Solution Sage
Solution Sage

It seems like you're trying to count distinct dates by month and year in Power BI, but you're getting incorrect counts. This could be due to the way Power BI handles duplicate dates within the same month.

Here's a possible solution:

1. Create a new column that combines the year and month. This can be done using the `MONTH` and `YEAR` functions in Power BI.


YearMonth = YEAR(Table[Date]) & "-" & MONTH(Table[Date])


2. Then, you can use the `CALCULATE` and `DISTINCTCOUNT` functions along with `ALLEXCEPT` to count the distinct dates for each month.

CountOfEnquiries = CALCULATE(DISTINCTCOUNT(Table[Date]), ALLEXCEPT(Table, Table[YearMonth]))

This measure will count the distinct dates for each `YearMonth`, ignoring any filters on other columns in the table.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Unfortunately this hasn't worked for both columns I am trying to count for.
For some reason the following results are occuring.
I have Only the correct count of Date Opened but not Date closed. I recieve a result of 0 rather than the 8 closures. 
If I use only Date Closed on my Y axis, I don't get a result for the latest closures of which there are 8. 
Opened and Closed are equal across all months, which is not accurate. 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.