How to compare column values

Resolved
Luciano Carvalho asked on January 16, 2018

Hi!
I have a question, but I do not know if it is possible to do it.
Sample:
----------------------------------------------------------------
Company    |    Total 2017   |    Total 2018   | Result
Coca-cola    |    100.00        |    50.00          | 50.00
Pepsi          |     300.00        |   300.00         | 00.00
-------------------------------------------------------------
I can compare values by column / cell ?

3 answers

Public
Dmytro Zvazhii Dmytro Zvazhii Flexmonster January 17, 2018

Hello Luciano,
Thank you for your question. Please have a look at the following jsfiddle example - https://jsfiddle.net/flexmonster/0r6eb1w3/7/. To achieve such behavior you need to pre-process data creating two separate fields ("Price-2017" and "Price-2018") which should contain the appropriate sum value for each field. After that please create the new calculated field with such formula:
sum(\"Price-2017\") - sum(\"Price-2018\") .
Let us know if the suggested above works for you.
Regards,
Dmytro.

Public
Luciano Carvalho January 17, 2018

The solution is pretty cool, however I'm using the type: dataSource: {dataSourceType: "ocsv", filename: "api/controllerName/get"} not the type in JSON.

With the solution you passed me the prepareData did not work, the function was not called.

I am studying the documentation while I await your return.
Thanks for the attention!

Public
Dmytro Zvazhii Dmytro Zvazhii Flexmonster January 17, 2018

Hello Luciano,
Thank you for the update. In such case, we recommend running the data pre-processing on the server side. You can add two additional fields with the appropriate data before running the compression. After that, you will be able to use the suggested above approach. 
Let us know if you have any additional questions.
Regards,
Dmytro.

Please login or Register to Submit Answer