mdevm
mdevm

Reputation: 97

Calculating difference of the values in same column of table by a date column of other table

I have some tables as shown in the image in Power BI. Basically I need to calculate the difference for a column named ACT Renew (Data type: whole number) listed in table RET ALL depending upon the Fiscal Year column from SQLServerDateTable.

So potentially the created measure should list the value as: Value = ( sum of ACT Renew where fiscal year = 2018) - (sum of ACT Renew where fiscal year =2017 )

I already have setup the relationship between these tables and from filtering perspective everything in syncing fine, I know this is much easy from filtering and I am able to do that but according to the requirement I need to write a measure for this to show it as a tile.

Any Help will be greatly appreciated. Thanks. enter image description here

Upvotes: 0

Views: 4489

Answers (1)

Alexis Olson
Alexis Olson

Reputation: 40204

You should be able to filter inside of CALCULATE to do this and if the tables are related it should just work.

MeasureValue = 
    CALCULATE(SUM('RET all'[ACT Renew]), SQLServerDateTable[FiscalYear] = 2018) -
    CALCULATE(SUM('RET all'[ACT Renew]), SQLServerDateTable[FiscalYear] = 2017)

Upvotes: 1

Related Questions