Forum Discussion

057Sophie's avatar
057Sophie
Helper II
2 years ago
Solved

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:

 

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

 

 

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

  • 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")

1 Reply

  • 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")