Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
See why BI users voted Qlik #1 in 11 categories. GET REPORT
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator
Creator

Mathematical division in a script

Hello everyone,

 

I have a KPI that i Use in a straight table which is let's just say the following one:

KPI N°1 = Sum(Measure 1)/Sum(Measure 2)

In the script when i write the same i get an error.

So I tried Measure1/Measure2 as KPI n°1

But the thing is i don't find the same result than before.

Anyone could help on the matter ?

Thank you

Labels (2)
1 Solution

Accepted Solutions
Highlighted
MVP
MVP

If you want to write it the same in script you need to have group by clause in your load statement like below

Load Field1,

           Field2,

          Sum(Measure1)/Sum(Measure2) as  [KPI n°1]

FROM Table

Group by Field1,Field2;

View solution in original post

3 Replies
Highlighted
MVP
MVP

If you want to write it the same in script you need to have group by clause in your load statement like below

Load Field1,

           Field2,

          Sum(Measure1)/Sum(Measure2) as  [KPI n°1]

FROM Table

Group by Field1,Field2;

View solution in original post

Highlighted
Creator
Creator

It says "invalid expression".

Indeed in the Measure 1 or Measure 2 Fileds there are "0" values sometimes.

What can u advice ?

Thanks 

Highlighted
Creator
Creator

Sorry it worked now.

Thanks for the advice !