Division of Values

major_ace
major_ace Member
edited August 2022 in Magic ETL

Hello Domo Ninjas - I'm trying to get a new value from a dataset, where I'm dividing 1 column by another. Its a strange way of measuring how much Sales is adding on Services to Product deals.

  • I'm getting errors both in Beast Mode, when I try MOD(ProdSales,SvcsSales )
  • And in DataFlows when I add a Calculator, attach it to the Dataset give a new column name, select the calculation type Division, select the 2 columns, and finally drag an output DataSet, name and save. When I run it, I get an error  {{ ::getInvalidText(datasource) }}

Any advice would be great...I'm stuck

Thx,

Rich

Best Answers

  • MichelleH
    MichelleH Coach
    Answer ✓

    Hi @major_ace if you are looking for a simple division, try this beast mode:

    sum(`ProdSales`)/sum(`SvcsSales`)
    


  • ST_-Superman-_
    Answer ✓

    Is your data clean? Meaning do you have values for all of your rows of data and are those values all in number format? That error message might indicate that Domo is trying to run a calculation on a text field.

    If the data is clean, you could try

    MOD(sum(`ProdSales`),sum(`SvcsSales`))
    



    “There is a superhero in all of us, we just need the courage to put on the cape.” -Superman

Answers

  • MichelleH
    MichelleH Coach
    Answer ✓

    Hi @major_ace if you are looking for a simple division, try this beast mode:

    sum(`ProdSales`)/sum(`SvcsSales`)
    


  • ST_-Superman-_
    Answer ✓

    Is your data clean? Meaning do you have values for all of your rows of data and are those values all in number format? That error message might indicate that Domo is trying to run a calculation on a text field.

    If the data is clean, you could try

    MOD(sum(`ProdSales`),sum(`SvcsSales`))
    



    “There is a superhero in all of us, we just need the courage to put on the cape.” -Superman
  • No, some rows were discounted to 0 and some have no value, where the Product was sold with either a discount to 0 or no Services were sold at all.

  • Thank you both! I went with the un-nested version @MichelleH posted, and it worked great! For some reason, my earlier attempts at nesting were throwing errors.

  • @major_ace - the MOD() function is not the same as dividing two values. But, as long as you have the output you are looking for.


    “There is a superhero in all of us, we just need the courage to put on the cape.” -Superman