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

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

Reply
057Sophie
Helper II
Helper II

DAX: Calculate datediff from two tables without relation

Hello,

 

I am struggling right now with some really simple issue but I can't get it straight.

So I have two tables.

One dimension table with a simple list of Projects, quite simple:

057Sophie_0-1703089466572.png

 

Then I have a table with a list of components, where each component has a validity start date and a validity end date.

 

057Sophie_1-1703089638768.png

 

My struggle today is on my report, I want to know if the effective from date is before the SOP Date of the project I have selected in my slicer.

 

So far no luck, I've tried calculated column and measures but somehow it never provides the expected result.

Thank you

1 ACCEPTED SOLUTION
057Sophie
Helper II
Helper II

I have finally solved my issue, it took half a day but I'm proud.

Solutions: declare two variables and make then the comparison: 

like:

Before introduction of project =
    VAR _Effectivefrom = SELECTEDVALUE('MBOM Extract Code Matrix'[Effective From])
    VAR _ProjectDate = SELECTEDVALUE('Project milestones'[SOP])
    RETURN
    if(_Effectivefrom<=_ProjectDate,"yes","no")

View solution in original post

1 REPLY 1
057Sophie
Helper II
Helper II

I have finally solved my issue, it took half a day but I'm proud.

Solutions: declare two variables and make then the comparison: 

like:

Before introduction of project =
    VAR _Effectivefrom = SELECTEDVALUE('MBOM Extract Code Matrix'[Effective From])
    VAR _ProjectDate = SELECTEDVALUE('Project milestones'[SOP])
    RETURN
    if(_Effectivefrom<=_ProjectDate,"yes","no")

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.

Top Solution Authors
Top Kudoed Authors