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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.