Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Looking back and in the future in DAX code

Hey all, this is a copy of a previous post I made. I already accepted it as the solution, but sadly I later realised I needed to add in more logic to the DAX.    Original Post: (Firstly, a sample o...
  • MFelix's avatar
    5 years ago

    Hi Anonymous ,

     

    Belive that this can be done by making the following:

    Relevance =
    VAR _1 =
        COUNTX (
            FILTER (
                Projects,
                Projects[CustomerID] = Activities[CustomerID]
                    && Activities[ActivityDate] >= Project[ProjectDateCreated] - 7
                    && Activities[ActivityDate] <= Project[ProjectDateCreated] + 30
            ),
            Projects[CustomerID]
        )
    RETURN
        IF ( ISBLANK ( _1 ), 0, 1 )