Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Add a division calculation between 2 values in the same column!

Hello, 

 

I am attempting to divide 2 rows in the same column. i.e. and receive a percentage of items that hit the "review" activity after the "start" activity? 

 

 

This could be accomplished on the model itself or via a quick measure on the report itself.

 

Thank you! 

  • The formula is written for the main PowerBI not Power Query. Do you really need to create the column in Power Query?

     

    I've attached the pbix

4 Replies

  • MNedix's avatar
    MNedix
    Solution Sage

    Heya,

     

    Here is the code:

     

    Forum = 
    VAR _start = CALCULATE(SUM('Table'[Count]),'Table'[Activity]="Start",ALLEXCEPT('Table','Table'[Office Worker]))
    VAR _review = CALCULATE(SUM('Table'[Count]),'Table'[Activity]="Review",ALLEXCEPT('Table','Table'[Office Worker]))
    RETURN
    IF('Table'[Activity]="Start", BLANK(), DIVIDE(_review,_start))

     

    PS: Format the new column as Percentage and you're good to go

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you for the quick reply, I am having some trouble getting it to take!

       

      I get an token eof on the first line? 

       

       

      Thank you!

  • MNedix's avatar
    MNedix
    Solution Sage

    The formula is written for the main PowerBI not Power Query. Do you really need to create the column in Power Query?

     

    I've attached the pbix

    • MNedix's avatar
      MNedix
      Solution Sage

      You create the column like the below:

       

      Or like this