Forum Discussion
Calculate difference vs the previous period
- Anonymous2 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
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
- BIstvan2 years agoResolver I
Anonymous Really amazing.
martaoldi00 I was just working on something very similar. I just want to present the way I choose to handle it.
I have used the attechment from above.
You can add a calculated column in the table to bring the previous values for each project.
Then you can create a measure to calculate the variance in percentage
- martaoldi002 years agoNew Member
Thank you so much Anonymous !! This worked perfectly