Forum Discussion

ilyakoslov's avatar
ilyakoslov
Frequent Visitor
3 years ago
Solved

Making a static baseline

Hey guys! So I'm new around here and I really need some help.  Cenario: - I have the costs of a company and they want me to make a comparison of costs, for example, between selected month and previ...
  • djurecic's avatar
    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!