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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anthony_A
Regular Visitor

Distinct count across multiple columns but looking for the latest date for the record

Hey Community, 

 

I have a data set that contains a list of stores and all of the health permits associated with it. The data also contains an issue start date and end date. 

 

I want to count the a distinct number of stores per certificate with latest start date. 

 

Example: 

Store Code: ABC123  Certificate Type: ServSafe Certificate Issue Start Date: 2/23/2024 Issue End Date: 2/23/2026

Store Code: ABC123  Certificate Type: ServSafe Helper Certificate Issue Start Date: 2/23/2024 Issue End Date: 2/23/2026

Store Code: ABC123  Certificate Type: ServSafe Certificate Issue Start Date: 2/23/2021 Issue End Date: 2/23/2024

 

Count should be 1 for ServSafe Certificate and 1 for ServSafe Helper Certificate.

 

Any guidance will be appreciated.

2 REPLIES 2
qqqqqwwwweeerrr
Super User
Super User

Hi @Anthony_A 

 

i guess this measure should work for you.

get_count =
VAR MaxDate_ = CALCULATE(MAX(Sheet3[Start Date]),ALLEXCEPT(Sheet3,Sheet3[Certificate Type]))
RETURN CALCULATE(DISTINCTCOUNT(Sheet3[Store ID]),Sheet3[Start Date]=MaxDate_)
 
Did I answer your question? if not please provide more details about the problem. Mark my post as a solution! Appreciate your Kudos!!
Check for more intersing solution here: https://www.youtube.com/@letssolveproblem


Regards
 
Regards
lbendlin
Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.