Forum Discussion

Johnsnowlife's avatar
Johnsnowlife
Icon for Helper III rankHelper III
9 years ago
Solved

Show Change between Min and max Dates

I am trying to show the change in the [% of Fund] for each instrument in the portfolio from the earliest date in the filter period to the latest date in the filter period. So far I have Change% = V...
  • Eric_Zhang's avatar
    9 years ago

    Johnsnowlife

    It is the filter that affects the expected output. Try to add ALLEXCEPT to your measure. If it doesn't work, please upload a sample pbix file.

     

    Change% =
    VAR MaxDate =
        CALCULATE ( MAX ( 'Calendar'[Date] ), ALLSELECTED ( 'Calendar'[Date] ) )
    VAR MinDate =
        CALCULATE ( MIN ( 'Calendar'[Date] ), ALLSELECTED ( 'Calendar'[Date] ) )
    RETURN
        CALCULATE (
            SUMX (
                ALLEXCEPT ( DataAllFunds, DataAllFunds[InstrCode] ),
                DataAllFunds[% of Fund]
            ),
            DataAllFunds[Date] = MaxDate
        )
            - CALCULATE (
                SUMX (
                    ALLEXCEPT ( DataAllFunds, DataAllFunds[InstrCode] ),
                    DataAllFunds[% of Fund]
                ),
                DataAllFunds[Date] = MinDate
            )