Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
lessassy
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
Kushal_Chawda

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
Kushal_Chawda

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;

lessassy
Creator
Creator
Author

It says "invalid expression".

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

What can u advice ?

Thanks 

lessassy
Creator
Creator
Author

Sorry it worked now.

Thanks for the advice !