Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
agaetisproject
Contributor III
Contributor III

Sum with multiple if/vlookups

I am blocked with what seems an easy issue.

I load an Excel file that combine hours or amounts for several cost items.

I agree this is a strange set-up but that is how the client structured its data and have worked around all the way down except for a KPI and a bar chart formula.

The result look like this after loading my it in Qlikview and computing the TotalFigure, MonthlyCost, TotalCost, MonthlyPrice, TotalPrice

          

Cat. ExpenditureCatStart DateEnd DateMonthYearNumberOfMonthMonthlyFigureTotalFigureMonthlyCostTotalCostMonthlyPriceTotalPrice
1. PersonnelEngineer1/01/201631/12/20161/01/20161250.00600.006,501.8378,021.936,989.4683,873.58
1. PersonnelExpert1/01/201631/12/20161/02/20161250.00600.006,501.8378,021.936,989.4683,873.58
2. Direct OverheadEngineer1/01/201631/12/20161/01/20161210.00120.001,300.3715,604.391,397.8916,774.72
2. Direct OverheadExpert1/01/201631/12/20161/02/20161210.00120.001,300.3715,604.391,397.8916,774.72
3. Travel15/01/201716/01/201715/01/201716,000.006,000.006,000.006,000.006,579.006,579.00
3. Travel23/03/201725/03/201723/03/2017119,200.0019,200.0019,200.0019,200.0021,052.8021,052.80
5. Equipment1/04/201616/03/20171/02/201712833.3310,000.00833.3310,000.00913.7510,965.00
5. Equipment1/04/201616/03/20171/03/201712833.3310,000.00833.3310,000.00913.7510,965.00
6. Dissemination/Communication 1/10/201631/12/20161/11/20163333.331,000.00333.331,000.00365.501,096.50
6. Dissemination/Communication 1/10/201631/12/20161/12/20163333.331,000.00333.331,000.00365.501,096.50
7. Miscellaneous1/05/201631/07/20161/06/201631,000.003,000.001,000.003,000.001,096.503,289.50
7. Miscellaneous1/05/201631/07/20161/07/201631,000.003,000.001,000.003,000.001,096.503,289.50
8. Risk 1/01/201631/12/20161/11/2016121,000.0012,000.001,000.0012,000.001,096.5013,158.00
8. Risk 1/01/201631/12/20161/12/2016121,000.0012,000.001,000.0012,000.001,096.5013,158.00
4. External Services15/04/201628/04/201615/04/2016110,000.0010,000.0010,000.0010,000.0010,965.0010,965.00
4. External Services1/07/20184/07/20181/07/201812,400.002,400.002,400.002,400.002,631.602,631.60

While I get want I want in a table, I can't manage to compute the sum of monthly cost in a KPI box or even in a bar chart.

The issue is that if Cat. Expenditure is 1. Personnal or 2. Direct Overhead, I need to apply an hourly rate [Hourly rate] from another table - see attached file - to transform the MonthlyFigure (which represents hours for those items) into a money amount. I need here to account for the Cat profile to select the right rate comprised in the Rate sheet.

But for all other cost items (3. Travel, 5. Equipment, ...), the MonthlyFigure is already an amount so I just need to sum up the amount.

I tried this formula but it does not work:


if([Cat. Expenditure]='1. Personnel (cat. PSS form 1)',sum(MonthlyFigure*[Hourly rate])

+

if([Cat. Expenditure]='2. Direct Overhead  (cat. PSS form 9)',sum(MonthlyFigure*[Hourly rate])

+

sum(MonthlyFigure)))

Same issue in a bar chart. I do not get the right value, unless I include Cat. Expenditure as a dimension.

Can you help me solve this issue?

Million thanks Community guys 🙂

14 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

The LOAD below should read:

MapRates:

Mapping LOAD ....

Jeff Robertz wrote:

I tried to make it work in my script but this does not work, any chance you can help me fix this?

Here is the script:

MapRates:

LOAD Cat,

  //[Basic hourly rate],

    //[Direct overhead],

    [Hourly rate]

FROM

...

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
swuehl
MVP
MVP

Not sure if I understand (seems your setting is different from my mock up attached above).

Could you change and upload the sample QVW from above so that it closer matches your setting?

agaetisproject
Contributor III
Contributor III
Author

Hi Swuehl,

I am trying to share the file with you but this chat seems it does not allow me doing so.

Do you know how to do?

Or alternatively, I could send you the file in direct and post it back to the community once solved.

What do you think?

Jeff

swuehl
MVP
MVP

I would prefer if you upload your sample file to the forum.

You should be able to upload a file by using the advanced editor: Either click on 'use advanced editor' in the top right corner of the editor, or try to edit an existing post of yours, this should also open the advanced editor.

In advanced editor, there is an 'attach' option on the lower right.

agaetisproject
Contributor III
Contributor III
Author

Stupid as it is, I can't attach the file here so I had to create a new post:

Product sum with multiple if

Sorry, not the cleanest way but I hope sharing a sample will help close both.