Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

create acumulate column using previous value row

Guys,
I want to create a column that use the acumulate percentual such as picture below:

In real, I tried to use productx using % Vlr Desistência, but I don't get the previus value of % Vlr Desistência linking with "Parcela" to create a measure in the correct form. Someane help me??

 

 

2 Replies

  • v-xiaosun-msft's avatar
    v-xiaosun-msft
    Community Support

    Hi Anonymous ,

     

    Since I don't know what the measure [% Vlr Desistência] in your formula is, I made a sample using the sample data you gave above, and here is my solution. You can create a calculated column as below.

    Sample data:

    Create a column.(EARLIER function is mostly used in the context of calculated columns.)

     

    Column =
    VAR _a =
        CALCULATE (
            1 - MAX ( 'Table'[%] ),
            FILTER ( 'Table', 'Table'[Column1] < EARLIER ( 'Table'[Column1] ) )
        )
    VAR _b =
        CALCULATE (
            1 - MAX ( 'Table'[%] ),
            FILTER ( 'Table', 'Table'[Column1] < EARLIER ( 'Table'[Column1] ) - 1 )
        )
    RETURN
        _a * _b

     

    Final output:

     

    I attach my sample below for your reference.

     

    Best Regards,
    Community Support Team _ xiaosun

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • Anonymous's avatar
      Anonymous
      Not applicable

      How can I create your table from my table that it has more than one value "Parcela" for example??

      this problem has two solution, like your answer but I don't know how create your table from my table. Or create a measure referencing the same table that will be placed this measure that I don't know too.

      Below I show that value in measure  % Vlr_Desistência and 

       

      % Vlr_Desistência = (CALCULATE(SUM(Base_PowerBI[VALOR]),Base_PowerBI[STATUS] = "C"))/SUM(Base_PowerBI[VALOR])
      % Qntd Desistência = (CALCULATE(SUM(Base_PowerBI[QTD]),Base_PowerBI[STATUS] = "C"))/SUM(Base_PowerBI[QTD])