How to Find Difference Between two Columns

Answered
TEG asked on June 10, 2019

Hi,

We are using CSV connection for pivot table.
1.I have to find out the Difference between two Columns and show it in next column.
Is there any possibility to do that. Please find the attached screen shot for the same.
Regards,
TEG

4 answers

Public
TEG June 10, 2019

PFA

Attachments:
FlexMonster.PNG

Public
Vera Didenko Vera Didenko Flexmonster June 12, 2019

Hello,
 
Thank you for writing to us.
 
The desired output can be achieved in the following way:
 
1. Reorganize the data
 
We kindly advise organizing the CSV data in the following manner: 
 
Create a column representing every month containing the corresponding value. For example, instead of:

CONTRACT_NUMBER, YEAR, MONTH, VALUE
H0524, 2014, January, 93
H0524, 2014, February, 59

   organize the data in the following way:

CONTRACT_NUMBER, YEAR, January, February
H0524, 2014, 93, 0
H0524, 2014, 0, 59

 
If using a JSON data source it is possible to manipulate the JSON data to achieve the same desired output. This is illustrated in the JSFiddle example.
 
2. Use calculated measure
 
    Create a calculated measure which will display the difference between January and February:

{
uniqueName: "Difference of Jan & Feb",
formula: "sum(\"January\") - sum(\"February\")",
caption: "Difference of Jan & Feb"
}

 
Here is a JSFiddle example for illustration.
 
Please let us know if this works fine for you.
 
Best Regards,
Vera

Public
TEG June 17, 2019

Hi,
Thanks for the response. 
I don't want to change the datastructure. is there any other way to do this with following data:

CONTRACT_NUMBER, YEAR, MONTH, VALUE
H0524, 2014, January, 93
H0524, 2014, February, 59
Public
Vera Didenko Vera Didenko Flexmonster June 19, 2019

Hello,
 
Thank you for your reply.
 
Please consider the following approach (without restructuring the CSV data):
 
The Difference aggregation can be used, however, only the difference between the columns will be displayed. 
 
Here is a JSFiddle example for illustration.
Please note that this should work for CSV data as well.
 
Would such an approach work for your case?
 
We are looking forward to hearing from you.
 
Best Regards,
Vera

Please login or Register to Submit Answer