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

Division by Zero!

I'll give an example: sum((Kill + Asist) /( Dead )), how do I do the same expression when Dead field is 0? When Dead field is 0, just  sum(Kill + Assist).

I need to do this in text object.

Thanks.

1 Solution

Accepted Solutions
MarcoWedel

Sum((Kill+Asist)*Alt(1/Dead,1))

View solution in original post

7 Replies
datanibbler
Champion
Champion

Hi Igor,

just put it into an IF_condition to use the neutral number 1 in case Dead=0 like

>> sum((Kill + Assist) / IF(Dead<>0, Dead, 1)) <<

Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

Hi,

You can use Alt() function, like

Alt(sum((Kill + Asist) /( Dead )), sum(Kill + Assist))

Aurélien

Help users find answers! Don't forget to mark a solution that worked for you!
Anonymous
Not applicable
Author

Hi, 

You can try

if(Dead=0,sum(Kill + Assist),sum((Kill + Asist) /( Dead ))))

Not applicable
Author

Thanks guys!

but Jannet's response worked best!

MK_QSL
MVP
MVP

Alt((Sum(Kill)+Sum(Asist))/Dead,0)

MarcoWedel

Sum((Kill+Asist)*Alt(1/Dead,1))

Not applicable
Author

Thanks, very useful post and great answers,

If your query is resolved, mark it with correct answer!

Regards,

Kuldeep