Forum Discussion

Naveennegi119's avatar
Naveennegi119
Icon for Helper III rankHelper III
7 years ago
Solved

Increase and decrease status

Hi all,   Data attached below ID Value increase / decrease How to do it in powerbi Formula use in Excel ABC-1 134       ABC-2 124 decrease ? IF(B3>=B2,"increase","decrease") ...
  • RahulYadav's avatar
    7 years ago

    Hi Naveennegi119,

    One more way to do it. 

     

    1. Add a Index column in Query Editor.

    2. Add Below formula in a Calculated column.

     

    Inc/Dec =
    VAR PervValue =
        CALCULATE (
            MAX ( Table2[Value] ),
            FILTER ( Table2, Table2[Index] = EARLIER ( Table2[Index] ) - 1 )
        )
    VAR prevID =
        CALCULATE (
            MAX ( Table2[ID] ),
            FILTER ( Table2, Table2[Index] = EARLIER ( Table2[Index] ) - 1 )
        )
    VAR PerValueRev =
        IF ( LEFT ( Table2[ID], 3 ) <> LEFT ( Table2[prevID], 3 ), BLANK (), PervValue )
    RETURN
        IF (
            PerValueRev = BLANK (),
            BLANK (),
            IF ( Table2[Value] > PerValueRev, "increase", "decrease" )
        )

     

     

    Thanks,

    Rahul

  • Zubair_Muhammad's avatar
    Zubair_Muhammad
    7 years ago

    Naveennegi119

     

    First add an index colum from Query Editor

    Then you can use this column

     

    Column =
    VAR previousvalue =
        CALCULATE (
            MIN ( Table1[Value] ),
            FILTER ( ALLEXCEPT ( Table1, Table1[ID] ), [Index] = EARLIER ( [Index] ) - 1 )
        )
    RETURN
        IF (
            previousvalue <> BLANK (),
            IF ( [Value] > previousvalue, "Increase", "decrease" )
        )