Back to forum

get difference from the result of two columns

Answered

I am working with the flat table because I am handling flat json data (I will leave an example of my data below). I wonder if I can generate a new column with the difference between expenses and income, can you give me an example? Or make me notice where there is an example of this in the documentation? please

var jsonData = [
{
project: "number 1",
expense: 4580,
income: 5674
},
{
project: "number 2",
expense: 5580,
income: 2349
},
{
project: "number 3",
expense: 5642,
income: 8976
}
];

3 answers

WebDataRocks Team WebDataRocks August 12, 2019

Hello FerCho,
 
Thank you for the question.
Seems you can achieve the described above by using Calculated Values. Please see the example: https://codepen.io/webdatarocks/pen/LwgvBx
Hope it helps.
 
Regards,
WebDataRocks Team

FerCho August 12, 2019

thanks for answering! This is exactly what I wanted, I have one more question: if I have an additional column for each object with a non-calculable value, for example a date field, is it possible to continue using this type of design? Or would I have to use a flat grid?

WebDataRocks Team WebDataRocks August 21, 2019

Hello FerCho,
 
As for the date field, you can use it in both pivot and flat forms and choose that better suits your needs.
 
Regards,
WebDataRocks Team

Move up