multiply columns of a table in Postgresql - postgresql

I'm having a table with a column which contains areas of soil types and a column with the productivities of the different soil types (ton/ha). I would like to multiply these columns to have the total productivity (in ton) but I cannot figure out how to do this. Can someone help?

Related

combine two columns and create one in ADF

as a step to create my dimensional data model I need to combine two columns and create one new referencing to the units of values from each columns.
I have among other tables one table that has yearly GDP of a country. the table has two columns GDP represented as MONEY (unit) and the other year change (% as unit). in my fact table I would like to have both in same column but with a new columns representing dimension (units). because of that I am wondering how to merge these two columns and create another one that would specify if the value comes from the column with units (%) or (money). this applies to other entities in the data model that can have different units for same variable.
thanks for your help!
Consider orginal data format :
enter image description here
We have quartal dates a series of economic indicator and their values, on the right side there is another table with dimensions of the economic indicator.
What I need is to change data so it should be like this (fact table with quartal date granularity) :
enter image description here
I have reproduced the above scenario with a sample data and able to combine the columns like below.
My sample data of two columns Money and Unit:
Use derived column transformation for the res column which will have the Unit or Money values. To know which column value, I have used another column which_value.
Expression for res column:
iif(isNull(Money),Unit,Money)
Expression for which_value column:
iif(isNull(Money), 'Unit', 'Money')
Result in Data preview:

Indexing into MAtlab table based on max value

I have a table T2 with 5 columns and 5 rows. The table columns are 'FirstName','Height','Shoesize','Gender' and 'Profession'.
I have to create a second table containing the 'FirstName','Height' and 'Profession' of the person with the maximum 'Shoesize'.
So far, I found the index of the maximum 'Shoesize'.
[m,i] = max(T2{:,3})
However I am struggling to index into the table to abstract the relevant values. Any help is highly appreciated!

Sum two columns together in Tableau

In Tableau, I am trying to figure out how to sum up the percentages of two columns. I calculated the percentages using the percentages of command and used the table option, from the analysis menu. This generated the table shown below. I would like a column that sums the 4 and 5 columns together to show a total percentage of 59.76 which is 26.83+32.93 from columns 4 and 5. How would I create this calculated field?
How I generated the percentages:

compute difference between 2 ranked columns in tableau

I am trying to find the difference between 2 columns in tableau. The catch though here is that each column is ranked based on a value. The difference i need is between these 2 ranked columns
The rank is computed using the table calculations rank function. Attaching the picture for more information
I am assuming "current" and "prior" are calculated fields.
Just create a new calculated field, here I'll call it "Result". In this field just minus your one from the other so:
[Current - Prior]
Then pull this new field into your measures values on your sheet.

Interactive Report - aggregate sum of multiple columns from one table multiply by values from another Table

I have a challenge in Oracle Apex - I would to sum multiple columns to give 3 extra rows namely points, Score, %score. There are more columns but I'm only choosing a few for now.
Below is an example structure of my data:
Town | Sector | Outside| Inside |Available|Price
Roy-----Formal----0----------0----------1------0
Kobus --Formal----0 ---------0--------- 1------0
Wika ---Formal----0----------0--------- 1------0
Mevo----Formal----1----------1----------1------0
Hoch----Formal----1----------1----------1------1
Points------------2----------2----------5------1
Score------------10---------10---------10------10
%score-----------20---------20---------50------10
Each column has a constant weighting (which serves as a factor and it can change depending on the areas). In this case, the weighting for the areas are in the first row of the sector Formal:
Sector |Outside| Inside |Available|Price
Formal----1----------1 ----------1-----1
Informal--1----------0 ----------2-----1
I tried using the aggregate sum function in apex but it wont work because I need the factor in the other table. This is where my challenge began.
To compute the rows below the report
points = sum per column * weighting factor per column
Score = sum of no of shops visited (in this case its 5) * weighting factor per column
% score = points/Score * 100
The report should display as described above. With the new computed rows below.
I kindly ask anyone to assist me with this challenge as I have tried searching for solutions but haven't come across any.
Thanks a lot for your support in advance!!