Forum Discussion

SukanyaGG's avatar
SukanyaGG
Regular Visitor
2 years ago

CALCULATED COLUMN

How to create a calucated column using two data set data:

ex:  using Jan month data and Feb month data i want to calculate % change? 

1 Reply

  • Hi SukanyaGG 

    The solution depends on your data model. If there is a one to many relationship between the two, the one on the many end can use RELATED to return a column  value from the related table. If there isn't you can  use LOOKUPVALUE granting that the result returns only one distinct value - eg no multiple value for the same month. You can also use CALCULATE to get the data from the other table. Example

    CALCULATE (
        SUM ( othertable[column] ),
        FILTER (
            othertable,
            othertable[lookup column] = EARLIER ( thistable[lookupvalue column] )
        )
    )
    

    SUM can be replaced with MAX, MIN, LASTNONBLANKVALUE, FIRSTNONBLANKVALUE, AVERAGE, etc.