Forum Discussion

lmundia's avatar
lmundia
Frequent Visitor
8 years ago
Solved

Append a filtered value to another value

I have a variance value generated from past months and I need to append it to future months, how can I do it in DAX, when I do CALCULATE(future_month_value+variance_from_past_months) my variance is s...
  • v-sihou-msft's avatar
    8 years ago

    lmundia

     

     

    In this scenario, I assume you want to assign the last non empty variance to your future months. You need to get the max date for all non empty variance entries. Then get the last non empty variance. It can be like: 

     

    =
    VAR MaxDate =
        CALCULATE (
            MAX ( Table[Date] ),
            FILTER ( ALL ( Table ), Table[Variance] <> BLANK () )
        )
    RETURN
        CALCULATE (
            SUM ( Table[Variance] ),
            FILTER ( ALL ( Table ), Table[Date] = MaxDate )
        )