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! Learn more

Reply
joyhackett
Helper II
Helper II

DAX query - should be simple, but I'm missing something

I have 2 tables that do not have a relationship:

Date (1/1/2019 - 12/31/2025)
- date_key
- full_date
EOM Month = FORMAT(DATE(1, MONTH('Date'[full_date]), 1), "mmmm")


Location (sample below)
- location_key
- start_date
- end_date

location sample data:
abc, 1/1/2020, 12/31/9999
lmn, 3/1/2022, 3/31/2022
xyz,  5/1/2022, 12/31/9999

My table should look like this:

EOMonthJan 2022Feb 2022Mar 2022Apr 2022May 2022
location count11212


And it does because my measure is this:

location count =
CALCULATE(
    DISTINCTCOUNTNOBLANK(Location[location_key]),
    Location[start_date] <= max('Date'[full_date]) && Location[end_date] >= max('Date'[full_date]))
   

But now, I want to filter based on the start_date and end_date, so if the user only wants to see locations that started between 3/1 and 5/1, abc will be filtered out and I'm left with:

EOMonthJan 2022Feb 2022Mar 2022Apr 2022May 2022
location count00101


I'm not sure how to add my start_date filter to the above DAX and still maintain the ability to show count by month.

All help appreciated! Thanks!

1 ACCEPTED SOLUTION
joyhackett
Helper II
Helper II

I guess I just needed to write it out 🙂

 

I'm not sure if this is the best way, but I found that if I add a hidden filter to my table where location_key is not null, then it works.

View solution in original post

1 REPLY 1
joyhackett
Helper II
Helper II

I guess I just needed to write it out 🙂

 

I'm not sure if this is the best way, but I found that if I add a hidden filter to my table where location_key is not null, then it works.

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.