Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Using DATEDIFF in measure

Hello! I've spent some time attempting to use DATEDIFF in a dax measure but failed to do so. Here's the basics; I have two tables, "Sales" and "Stores". I am trying to display sales over time within ...
  • AlB's avatar
    5 years ago

    Anonymous 

    Sales Filter =
    VAR CurrentYear_ =
        YEAR ( MAX ( DateT[Date] ) ) // This could also be:  VAR CurrentYear_ = MAX(DateT[Year]) 
    RETURN
        CALCULATE (
            SUM ( Sales[sale] ),
            FILTER ( Sales, YEAR ( RELATED ( Stores[OpenedDate] ) ) <> currentYear_ )
        )

    Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

    Contact me privately for support with any larger-scale BI needs, tutoring, etc.

    Cheers