Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Substract Values from Same column dynamically based on another field.

I have a table (See below) with prices for different years     I have 250 Trade Days in each contract period from 11/01 to 10/31 each year.   I need to dynamically select (what if) table o...
  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi Anonymous ,

    Please try to update the formula of your measure "Profit" just like below(the red font part is newly add):

    Profit =
    CALCULATE (
        SUM ( Winter_Contracts_Zema[Price] ),
        FILTER (
            ALL ( Winter_Contracts_Zema[Trade Day - Buy] ),
            Winter_Contracts_Zema[Trade Day - Buy] = [Buy_Trade Value]
        )
    )
        CALCULATE (
            SUM ( Winter_Contracts_Zema[Price] ),
            FILTER (
                ALL ( Winter_Contracts_Zema[Trade Day - Buy] ),
                Winter_Contracts_Zema[Trade Day - Buy] = [Sell_Trade Value]
            )
        )

    Best Regards

    Rena

  • Anonymous's avatar
    Anonymous
    6 years ago

    I solved it by using the value function in my measure! thanks to everyone who took the time to read this!