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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
lorasloan
Frequent Visitor

Measure that filters based on create date to unrelated calendar date

I have a data table and a calendar table with no relationship.  I need to create different measures based on different dates from data table (e.g. Count(id) where open date=calendar date, Count(id) where closed date= calendar date.  

 

I'm using calendar date as my base column in table.   I've tried calculate and countx(filter... and it finds the first date of one table but when I select equal '=' (to get the second date) it won't show up.  

 

I've tried using 

OpenReq = var caldates=DISTINCT('Calendar'[MonthYYMM]) return CALCULATE(vw_Overall_Scorecard_RICs[OpenRICs],FILTER(vw_Overall_Scorecard_RICs,vw_Overall_Scorecard_RICs[OpenDateYYMM] in caldate ))
 
but I get no values.  I've verified both date formats are the same.  
 
1 ACCEPTED SOLUTION

Hi, @lorasloan 

I did not find any errors in your formula. I suspect this has something to do with your table structure

Can you show screenshots of your original data of the two tables?

You can also try the following formula:

OpenReq2 =
    CALCULATE (
        vw_Overall_Scorecard_RICs[OpenRICs],
        FILTER (
            vw_Overall_Scorecard_RICs,
            vw_Overall_Scorecard_RICs[OpenDateYYMM] IN VALUES ( 'Calendar'[MonthYYMM] )
        )
    )

Best Regards,
Community Support Team _ Eason

 

View solution in original post

6 REPLIES 6
AlexisOlson
Super User
Super User

The caldate inside the FILTER doesn't match the variable caldates. I'd also expect [OpenRICs] to be wrapped in a COUNT or DISTINCTCOUNT function rather than having a raw column reference.

the caldates/caldate was a typo on my part.  They are the same.  OpenRICs is already a measure with a count.  

Got it. FYI, general practice is not to use table names with measures to avoid this sort of confusion (and because it doesn't make much difference what table they're stored on).

 

How is [OpenRICs] defined?

OpenRICs = count(vw_Overall_Scorecard_RICs[ric_pk])
 
Thanks

Hi, @lorasloan 

I did not find any errors in your formula. I suspect this has something to do with your table structure

Can you show screenshots of your original data of the two tables?

You can also try the following formula:

OpenReq2 =
    CALCULATE (
        vw_Overall_Scorecard_RICs[OpenRICs],
        FILTER (
            vw_Overall_Scorecard_RICs,
            vw_Overall_Scorecard_RICs[OpenDateYYMM] IN VALUES ( 'Calendar'[MonthYYMM] )
        )
    )

Best Regards,
Community Support Team _ Eason

 

@v-easonf-msft 

 

I ended up going a different direction using an active relationship from table to calendar for opendate and inactive relationship with closeddate, then used function userrelationship for closeddate measure.  

 

I did create a new report to test out code and both my original code and yours worked.   I think something was wrong with the value 'Calendar'[MonthYYMM] in my original report.  

 

Thank you for followup.  

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.