Forum Discussion

Pikachu-Power's avatar
Pikachu-Power
Impactful Individual
5 years ago
Solved

DAX optimization: ValueMonth minus ValueMonthBefore

Hi all,   i have the following measure that works fine. but is there a way to write it more compact? I have created two sepatated month and year tables and integrated the SELECTEDVALUE in the formu...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Pikachu-Power 

     

    have a try with your connected Calendar

    test =
    VAR CurSales =
        CALCULATE ( SUM ( Tabel1[Value] ), Tabel1[Categorie] = "A" )
    VAR PreSales =
        CALCULATE (
            SUM ( Tabel1[Value] ),
            Tabel1[Categorie] = "A",
            DATEADD ( Calendar[Date], -1, MONTH )
        )
    RETURN
        CurSales - PreSales