Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
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.

1 Solution

Accepted Solutions
sunny_talwar

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

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

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