Forum Discussion

mohd89ali's avatar
mohd89ali
Frequent Visitor
6 years ago
Solved

increase/decrease difference percentage

Hi all,    i am working on a COVID-19 dashboard and i am facing a problem calculating the increase/decrease in the difference by percent.    look at the table below    Country/Region Provin...
  • v-gizhi-msft's avatar
    6 years ago

    Hi,

     

    Please try this measure:

    Measure = 
    VAR a =
        IF (
            MAX ( 'Table'[Difference] )
                = MINX ( ALLEXCEPT ( 'Table', 'Table'[Case_Type] ), 'Table'[Difference] ),
            1,
            CALCULATE (
                MAX ( 'Table'[Difference] ),
                FILTER (
                    ALLSELECTED ( 'Table' ),
                    'Table'[Case_Type] IN FILTERS ( 'Table'[Case_Type] )
                        && 'Table'[Date] < MAX ( 'Table'[Date] )
                )
            )
        )
    RETURN
        ( MAX ( 'Table'[Difference] ) - a ) / a

    The result shows:

    Here is my test pbix file:

    pbix 

    Hope this helps.

     

    Best Regards,

    Giotto Zhi