I am quite newbie in cognos. I wonder how I can create a variable as percentage from the total. I have the following table containing a variable named compliant which can either be Y or No.
| Y | N | Total | percentage_Y_of_total% |
|---|---|---|---|
| 1 | 3 | 4 | 25% |
I created the Y and N variable with
case when Complaint_VAR ('Y') then 'Compliant' else 'Non-Compliant' end
My question: How do I create percentage_Y_of_total variable? How do I create a data item as percentage of the total split by case when clause?
Go to query explorer. Tool box. Drag data item to the details to create custom expressions
Use function total and define the scope, let's call the data item Y_Total. For example the expression would look like:
Total(Y for company, year, month)
Create another data item Overal_Total that gets the total rows of data
Create a calculation data item called percentage_Y_of_total% that takes Y_Total divided by Overal_Total