Hi there,
how can I compare two or more columns which each other and create a field which shows the difference of the value of these two columns?
Example:
You have several scenarios with costs forecasts. In Quicksight you want to compare the costs on yearly basis of these scenarios.
Has someone an idea how to solve this?
![2023-10-17 19_20_30-prod analysis](https://d1wl4jav5dp96l.cloudfront.net/original/2X/8/8f3ae0faf3cb119c6f6a3113d0991903d35b2ff0.jpeg)
Thank you very much
Hi @de.schmidd ,
There are a couple ways to do this:
- Create a calculated field and use the periodOverPeriod functions. For instance you can create a ‘sales difference’ as follows:
periodOverPeriodDifference(sum({Sales}), {TransactionDate}, MONTH, 1)
There’s a handful of these functions for different scenarios, like periodOverPeriodSum(), periodOverPeriodAvg(), etc
- You can add a table calculation to a pivot table from any of the Values:
![Screenshot 2023-10-17 at 3.12.26 PM](https://d1wl4jav5dp96l.cloudfront.net/original/2X/2/21586b7407699b43d25e5bc783419cedc2176026.png)
And notice that you have the option on how it’s calculated with the ‘Calculate As’ option.
Hope that helps!
ws
1 Like