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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
AW1976NOVA
Post Patron
Post Patron

Count DISTINCTVALUE with a FILTER for a specific date

Hi,

 

I have a created measure that I believe should be correct but it is not.

 

I would like to count the DISTINCTCOUNT of the field 'Eligibility Data'[Member ID (Elig)] with a filter for the specific date of 11/30/2020 in the field 'Eligibility Data'[Coverage Date End (Elig)].

 

Here is my existing created measure that I've come up with (but it is not returning a value):

 

Distinct Count of Eligibile Members =

CALCULATE(DISTINCTCOUNT('Eligibility Data'[Member ID (Elig)]), FILTER('Eligibility Data','Eligibility Data'[Coverage Date End (Elig)] = "11/30/2020"))
 
When I originally bring the data in to Power BI the 'Eligibility Data'[Coverage Date End (Elig)] field is brought in as a text field.  I've gone ahead and transformed the field in Edit Queries from a text field to a Date field.
 
Is this why my formula is not acknowleging "11/30/2020" as a date?  Is it looking for a text value with "11/30/2020" when I've already transformed it to a date field?
 
If so, how do I modify my existing created measure to look up 11/30/2020 as a date and not a text value?
1 ACCEPTED SOLUTION
AlB
Super User
Super User

Hi @AW1976NOVA 

Sure, it will be looking for that string. Use

DATE(2020, 11, 30)

instead of

"11/30/2020"

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

View solution in original post

1 REPLY 1
AlB
Super User
Super User

Hi @AW1976NOVA 

Sure, it will be looking for that string. Use

DATE(2020, 11, 30)

instead of

"11/30/2020"

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.