Forum Discussion
Using DATEDIFF in measure
- 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
Hi Anonymous
Let's try and clarify. You say you want to display the sales of store that have not been opened within that year
What does that mean exactly and what fields would be used to determine it? Please provide examples to clarify: shops that will be included and shop that will be excluded
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
Hey! Yes that is precisely what I am attempting to do. To display the sales of store that have not been opened within that year as you say.
In the "Stores" table, a column named "OpenedDate" displays the opening date of the store (dd-mm-year). Whether or not a store should be dispayed in the sales is determined if its opening date is the same as the selected year.
In other words, with the year slicer on year 2020, the store of ID 1 with an opening date of 01-01-2020 should be excluded while store of ID 2 with an opening date of 01-01-2015 should not.