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
user900
Helper II
Helper II

Help with Date

I have a data file that includes a Report Month field (10/1/2022 through 10/1/2023).  Data type is set as Date.  I want to create a measure to get the distinct count of IDs on or before 7/1/2023.  But when I do, it assumes 10/1/2023 is within that period.  Why and what do I need to fix it?

 

Thanks for any help.

 

1 ACCEPTED SOLUTION
Uzi2019
Super User
Super User

Hi @user900 
Please try below measure

Total Count= CALCULATE(COUNT('Table'[ID]),FILTER('Table','Table'[Date]<=DATE(2023,07,01)))

If my post helps please give kudos and accept it as a solution!
Thanks
Don't forget to give thumbs up and accept this as a solution if it helped you!!!

View solution in original post

5 REPLIES 5
Uzi2019
Super User
Super User

hi @user900 

can you do the following calculation:
Total Count= CALCULATE(DISCTINCTCOUNT('Table'[ID]),FILTER('Table','Table'[Date]<=DATE(2023,07,01)))

 

If my post helps please give kudos and accept it as a solution!
Thanks

Don't forget to give thumbs up and accept this as a solution if it helped you!!!
Uzi2019
Super User
Super User

Hi @user900 
Please try below measure

Total Count= CALCULATE(COUNT('Table'[ID]),FILTER('Table','Table'[Date]<=DATE(2023,07,01)))

If my post helps please give kudos and accept it as a solution!
Thanks
Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Fantasic!  I did make a minor change.

Total Count= CALCULATE(DISTINCTCOUNT('Table'[ID]),FILTER('Table','Table'[Date]<=DATE(2023,07,01)))

 

Thank you so much.

Ritaf1983
Super User
Super User

Hi @user900 

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Please show the expected outcome based on the sample data you provided.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Sample data:

Report MonthID
10/1/2022683
11/1/2022683
12/1/2022683
1/1/2023683
2/1/2023683
3/1/2023683
4/1/2023683
5/1/2023683
6/1/2023683
7/1/2023683
8/1/2023683
9/1/2023683
10/1/2023683
10/1/2022160
11/1/2022160
12/1/2022160
1/1/2023160
2/1/2023160
3/1/2023160
4/1/2023160
5/1/2023160
6/1/2023160
7/1/2023160
8/1/2023160
9/1/2023160
10/1/2023160

 

I'm expecting for the months Oct 2022 through July 2023 to have an outcome of 2.  The issue I have is it also returns 2 for Oct 2023 and shouldn't.

 

My measure is: CALCULATE(DISTINCTCOUNT('Table'[ID]),'Table'[Report Month]<="7/1/2023")

Report MonthExpected Outcome
10/1/20222
11/1/20222
12/1/20222
1/1/20232
2/1/20232
3/1/20232
4/1/20232
5/1/20232
6/1/20232
7/1/20232
8/1/2023 
9/1/2023 
10/1/2023 

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.