Forum Discussion
Anonymous
5 years agoNot applicable
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 ...
- 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
AlB
5 years agoCommunity Champion
Anonymous
Your code above is missing a closing parenthesis. Not sure if that's a typo when copying it here or if it is the actual problem.
Do make sure you build the condition correctly according to what you want. Right now you are selecting stores that both opened AND went thru a refit in another year.
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
Anonymous
5 years agoNot applicable
Thanks so much! It now works as attended.