Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

KPI Sum expression problem

Hi

I try to make a KPI that calculate total cost for rearing a car

The data are spreed in several spread sheets.

In sheet 1 I have

Repair no                    Part changed

1                                   Tires

2                                   Engine

3                                   Screw

4                                   Tires

5                                   Screw

In sheet 2 I have

Part changed          Price

Tires                         100

Engine                      8100

Screw                       1

Front glass               300

I tried with this expression

Sum([Price]*Count([Repair no]))

But it doesnt work, can you give me a hint whats wrong?

Thanks,

Peter

20 Replies
sunny_talwar

May be this

Sum([Price])*Count([Repair no])

krishna_2644
Specialist III
Specialist III

check this out.you forgot to aggregate with respect to each and every part changed for both sum and count.

1.PNG

shilpan
Partner Ambassador
Partner Ambassador

See attached qvw

sahadevpatil140
Partner - Contributor III
Partner - Contributor III

May be this Expected output-

KPI Issue.JPG

Anonymous
Not applicable
Author

Thanks all of you, it is solved with your input

krishna_2644
Specialist III
Specialist III

Pls close the thread

Anonymous
Not applicable
Author

Hi,

When I use Sum([Price])*Count([Repair no]) I get a wired number

Krishna what expression did you use?

krishna_2644
Specialist III
Specialist III

= sum({$< [Part changed]={'Engine'}> }Price)* count({$< [Part changed]={'Engine'}> }[Part changed]) +

  sum({$< [Part changed]={'Tires'}> }Price) * count({$< [Part changed]={'Tires'}> }[Part changed]) +

  sum({$< [Part changed]={'Screw'}> }Price)* count({$< [Part changed]={'Screw'}> }[Part changed])

As you have different parts and each have respective counts and aggregation, the below expression yields wierd numbers.

Sum([Price])*Count([Repair no])

Anonymous
Not applicable
Author

Thanks

What if the numbers of parts on the list is huge fx several hundreds, is there a better way to solve the issue?