## Social Items

My Friend got a Scenario where he was asked to subtract the prior value from the current value of the column. I helped him by finding the Solution on the Microsoft community I did not find the correct solution on it.

I have prepared the demo for describing the solution for the problem "Subtracting Prior Value from Current Value of a Column in Power BI "

So Let`s Start!!!

Step 1: I have created a dummy table "YearRevenue Table" with columns Revenue and Years.

Step 2: Now Create a Measure in the same table and place the DAX code mention below:

Diff = VAR Currentyear= MAX('YearRevenue Table'[Years])
VAR PreviousYears=MAX('YearRevenue Table'[Years])-1
VAR CurrentValue=CALCULATE(SUM('YearRevenue Table'[Revenue]),'YearRevenue Table'[Years]=Currentyear)
VAR PREVIOUSVALUE=CALCULATE(SUM('YearRevenue Table'[Revenue]),'YearRevenue Table'[Years]=PreviousYears)
VAR result= CurrentValue-PREVIOUSVALUE
return result

Step 3: After creating a Diff measure using the dax code, Place all the columns in the table
in Power View.

I hope the solution will help the developer to implement it in their report. ## DAX Variables in PowerBI-Subtracting Prior Value from Current Value of a Column

My Friend got a Scenario where he was asked to subtract the prior value from the current value of the column. I helped him by finding the Solution on the Microsoft community I did not find the correct solution on it.

I have prepared the demo for describing the solution for the problem "Subtracting Prior Value from Current Value of a Column in Power BI "

So Let`s Start!!!

Step 1: I have created a dummy table "YearRevenue Table" with columns Revenue and Years.

Step 2: Now Create a Measure in the same table and place the DAX code mention below:

Diff = VAR Currentyear= MAX('YearRevenue Table'[Years])
VAR PreviousYears=MAX('YearRevenue Table'[Years])-1
VAR CurrentValue=CALCULATE(SUM('YearRevenue Table'[Revenue]),'YearRevenue Table'[Years]=Currentyear)
VAR PREVIOUSVALUE=CALCULATE(SUM('YearRevenue Table'[Revenue]),'YearRevenue Table'[Years]=PreviousYears)
VAR result= CurrentValue-PREVIOUSVALUE
return result

Step 3: After creating a Diff measure using the dax code, Place all the columns in the table
in Power View.

I hope the solution will help the developer to implement it in their report.