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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
colliers_sn
Contributor II
Contributor II

Cost Allocation

Hello,

Hope I can get some assistance with putting together a solution to allocate my costs.  Ideally on the script side.

I have costs that I receive monthly that I want to allocate out to various departments based on their headcount.  Sample data below.

Expenses:

Expense TypeAmount
Telecom5000
Network services8000

Headcount:

DeptHeadcount
Dept 120
Dept 230

The goal is to get this result.

Alocated Expenses:

DeptExpense TypeAmount
Dept 1Telecom2000
Dept 1Network Services3200
Dept 2Telecom3000
Dept 2Network Services4800

Any ideas would great be appreciated.

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

Try this:

HeadCount:

LOAD Dept,

     Headcount

FROM

[https://community.qlik.com/thread/216883]

(html, codepage is 1252, embedded labels, table is @2);

Join(HeadCount)

LOAD Sum(Headcount) as Total

Resident HeadCount;

Join(HeadCount)

LOAD [Expense Type],

     Amount

FROM

[https://community.qlik.com/thread/216883]

(html, codepage is 1252, embedded labels, table is @1);

FinalTable:

LOAD Dept,

  [Expense Type],

  Amount * Headcount/Total as Amount

Resident HeadCount;

DROP Table HeadCount;


Capture.PNG

View solution in original post

3 Replies
sunny_talwar
MVP
MVP

Try this:

HeadCount:

LOAD Dept,

     Headcount

FROM

[https://community.qlik.com/thread/216883]

(html, codepage is 1252, embedded labels, table is @2);

Join(HeadCount)

LOAD Sum(Headcount) as Total

Resident HeadCount;

Join(HeadCount)

LOAD [Expense Type],

     Amount

FROM

[https://community.qlik.com/thread/216883]

(html, codepage is 1252, embedded labels, table is @1);

FinalTable:

LOAD Dept,

  [Expense Type],

  Amount * Headcount/Total as Amount

Resident HeadCount;

DROP Table HeadCount;


Capture.PNG

colliers_sn
Contributor II
Contributor II
Author

Hey Sonny....that worked perfectly...thanks so much.

sunny_talwar
MVP
MVP

Great

If you got what you were looking for, please close the thread by marking the correct answer

Qlik Community Tip: Marking Replies as Correct or Helpful