Forum Discussion

martaoldi00's avatar
martaoldi00
New Member
2 years ago
Solved

Calculate difference vs the previous period

Hello PBI Community.   I have a table with three columns: 1. Project Names 2. Forecast periods (1,2,3,4) and 3.Costs (€m). I need to create a visualization-table where I can see the differences bet...
  • Anonymous's avatar
    Anonymous
    2 years ago

    ryan_mayu Thanks for your contribution on this thread.

    Hi martaoldi00 ,

    I created a sample pbix file(see the attachment), please check if that is what you want. You can update the formula of your measure [_MW Delta] as below:

    _MW Delta = 
        VAR Per = SELECTEDVALUE('Upper+Baseline'[Period])
        VAR Prev_Period = Per - 1
        VAR _project=SELECTEDVALUE('Upper+Baseline'[Project Names])
        VAR Actual =
            CALCULATE(
                SUM('Upper+Baseline'[€m]),
                'Upper+Baseline'[Period] = Per
            )
        VAR Previous=
            CALCULATE(
                SUM('Upper+Baseline'[€m]),
                FILTER(ALLSELECTED('Upper+Baseline'),'Upper+Baseline'[Project Names]=_project&&'Upper+Baseline'[Period] =Prev_Period)
            )
        RETURN
              IF(ISBLANK(Previous),BLANK(), Actual - Previous)

    Best Regards