Forum Discussion

bolabuga's avatar
bolabuga
Helper V
9 years ago

query editor calculation.

 

Hello, i would like some help, im trying to do the following on the query editor.

 

as shown on the screenshot for the columns, i need to do:

 

[sum of consumes] divided [sum of homes] filtered when [type = "R"] and [ identification = "condominios" ]

 

thks.

9 Replies

  • CahabaData's avatar
    CahabaData
    Memorable Member

    You seek a single value - that is displaying in a new column - and that single value is the same on every row?

     

    If not please clarify with an example of a few rows that are your goal.

  • You can use something like this and once you get your desired column, you can do some either using Invoke Custom Function or Custom Column.

    • bolabuga's avatar
      bolabuga
      Helper V

      Thks Bhavesh, but i dont think i can use that example.

       

      Because the columns that i need to divide have lots of differents values, or at least im not seeing how this would apply to my case where i want 1 value across all rows in a new column, and this value is the result of the formula above.

      • CahabaData's avatar
        CahabaData
        Memorable Member

        I would suggest then that you keep things simple and do it step by step rather than in one task.

         

        Make a calculated column:    sumC = Sumx(Table,Field)

        Make a calculate column:      sumH = Sumx(Table,Field)

         

        this allows you to visually verify

         

        then make a calculated column: Final = IF([type] = "R" AND [identification] = "condominios"),sumC/sumH,0)