Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
bellesol
Creator
Creator

Divided

Hi,

I have two tables that connected with the field "Sub-Department"

Expenses table:

DepartmentSub DepartmentExpense TypeExpenses$
Production Production-ASalaries100
Production Production-AMaintenance399
Production Production-BEnergy488
Production Production-Management Salaries400
DevelopmentDevelopment-ASalaries100
DevelopmentDevelopment-AMaintenance2454
DevelopmentDevelopment-BEnergy450

 

Output Table:

Sub DepartmentOutput
Production-A300
Production-B400
Production-C500
Production-D600
Development-A700
Development-B500
Development-C567

 

I want to display the following table:

DepartmentExpense TypeExpenses$OutputOutput-result
Production Salaries500sum(expense on salaries)/sum(output by Sub-Department whose name begins with Production )500/1800
Production Maintenance399sum(expense on Maintenance)/sum(output by Sub-Department whose name begins with Production )399/1800
Production Energy488sum(expense on Energy)/sum(output by Sub-Department whose name begins with Production )488/1800
DevelopmentSalaries100sum(expense on salaries)/sum(output by Sub-Department whose name begins with Development )100/1767
DevelopmentMaintenance2454sum(expense on Maintenance)/sum(output by Sub-Department whose name begins with Development )2454/1767
DevelopmentEnergy450sum(expense on Energy)/sum(output by Sub-Department whose name begins with Development )450/1767

 

In the column "Output" I'd like to divide the sum of expenses type by department, with the total value of "output"  by the sum of all output of the Sub-departments that start with the beginning of the department that displayed in the first column.

How do I create the column "output"?

Labels (1)
5 Replies
spividori
Specialist
Specialist

Hi.

See the attached example. Hope this helps!.

Regards.

bellesol
Creator
Creator
Author

Thanks for your replay!

but in my original model, I have a lot of Department and sub-department so it's not possible to build it manually in the script.

If I will add the column "Department" to the table "output" it will be possible to build the calculation in the UI? 

spividori
Specialist
Specialist

Hi.

I understand that if, add it and I try it, it would even be easier for UL.

Sorry, my english is poor. I hope to make myself understood.

Regards.

bellesol
Creator
Creator
Author

Please see the attachment

spividori
Specialist
Specialist

See if it is what you need.

Regards.