I have a data set that looks like this:
Column A | Column B | Column C |
---|---|---|
Q1 | 1743 | 382 |
Q1 | 1376 | |
Q2 | 1599 | 419 |
Q2 | 1283 |
I have a data set that looks like this:
Column A | Column B | Column C |
---|---|---|
Q1 | 1743 | 382 |
Q1 | 1376 | |
Q2 | 1599 | 419 |
Q2 | 1283 |
And my goal is to create a calculated field that takes the number in Column C and divides it by the sum of the numbers in Column B that fall within the same date range. For example, the calculation for Q1 would be 382 / (1743 + 1376)
Thanks in advance!
Best, Abraham
P.S. - I tried to use the SUM and IF functions, but I received an error message that told me that SUM is an invalid function.
Share Improve this question edited Feb 5 at 20:23 Abraham Maalouf asked Feb 5 at 20:21 Abraham MaaloufAbraham Maalouf 12 bronze badges1 Answer
Reset to default 0Not sure what you want to do with the calculated field once its calculated but the example below will create the calculated field in separate table and link to the main data table on the Column A
field:
RawData:
Load * Inline [
Column A, Column B, Column C
Q1 , 1743 , 382
Q1 , 1376 ,
Q2 , 1599 , 419
Q2 , 1283
];
CalculatedData:
Load
[Column A],
sum([Column C]) / sum([Column B]) as CalcField
Resident
RawData
Group By
[Column A]
;
Once the script is reloaded the data model will be as the image below and the CalcField
will have values below: