Forum Discussion
Making a static baseline
- 3 years ago
Hi ilyakoslov ,
I assume you are using a separate date table- if not please add one.
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/
Then you can do something like this (adjust for your table and field names)
Measue for month 12 from last year =
VAR _month = 12
VAR _lastyear =
SELECTEDVALUE (Datetable[Year] )
RETURN
CALCULATE (
[Your Measure],
FILTER ( ALL ( Datetable ), Datetable[Month] = _month && Datetable[Year] = _lastyear )
)Please accept as solution if this answers the question- thanks!
Hi ilyakoslov ,
I assume you are using a separate date table- if not please add one.
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/
Then you can do something like this (adjust for your table and field names)
Measue for month 12 from last year =
VAR _month = 12
VAR _lastyear =
SELECTEDVALUE (Datetable[Year] )
RETURN
CALCULATE (
[Your Measure],
FILTER ( ALL ( Datetable ), Datetable[Month] = _month && Datetable[Year] = _lastyear )
)
Please accept as solution if this answers the question- thanks!
- ilyakoslov3 years agoFrequent Visitor
Hey djurecic thank you SO MUCH, you were really fast and actually solved it. The only thing I had to change was that in your _lastyear variable you forgot to do it -1. Meaning that it must be from last year, not from the selected year. Anyway, small mistake. Thank you for the help!