Forum Discussion

atul9063's avatar
atul9063
Helper III
7 years ago
Solved

Calculate Previous Month Without Using Measure

Hi Team,   I have to calculate Prev month Value in column without using measure .   Currently, i m using below formula in measure to calculate previous month.But i want same output using caluclat...
  • Zubair_Muhammad's avatar
    Zubair_Muhammad
    7 years ago

    atul9063

     

    Try this one

     

    Column =
    CALCULATE (
        SUM ( Table1[MetricValue] ),
        DATEADD ( Table1[Date], -1, MONTH ),
        ALLEXCEPT ( Table1, Table1[Date] )
    )
    

     or this one

     

    Column =
    CALCULATE (
        SUM ( Table1[MetricValue] ),
        FILTER (
            Table1,
            Table1[Date].[MonthNo]
                = EARLIER ( Table1[Date].[MonthNo] ) - 1
        )
    )
    
  • Zubair_Muhammad's avatar
    Zubair_Muhammad
    7 years ago

    atul9063

     

    Did you use first formula?

    Could you show your formula?

     

    Column =
    CALCULATE (
        SUM ( Table1[MetricValue] ),
        DATEADD ( Table1[Date], -1, MONTH ),
        ALLEXCEPT ( Table1, Table1[Date] )
    )
  • v-piga-msft's avatar
    v-piga-msft
    7 years ago

    Hi atul9063,

     

    By my tests, the last formula from Zubair_Muhammad should solve your problem.

     

     

    If you have solved, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.

     

    If you still need help, please feel free to ask.

     

    Best  Regards,

    Cherry