Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
srikantj
Creator
Creator

Mod function in qlikview

I am learning Mod function in qliksense. Below are the examples.

Examples Results

Mod( 7,2 )

Returns 1

Mod( 7.5,2 )

Returns NULL

Mod( 9,3 )

Returns 0

Mod( -4,3 )

Returns 2

Mod( 4,-3 )

Returns NULL

Mod( -4,-3 )

Returns NULL

 

In above table Mod(-4,3) returns value 2. how it got calculated. when "4" divided by  "-3" how it's going to return value"2".

Can someone explain this

Labels (2)
1 Solution

Accepted Solutions
marcus_sommer

It's a quite complicated matter if the parameters aren't positive integers and there various logically + technically implications in regard where and in which tool it's used and which kind of handling respectively returning results are regarded as expected or not. A good starting point to dive deeper would be:

Modulo - Wikipedia

Without any special reason I suggest to ensure that all parameters are positive integers (applying ceil/floor() and abs() and/or alt() or range-functions to the parameters) or using another logic to get the needed results.

View solution in original post

1 Reply
marcus_sommer

It's a quite complicated matter if the parameters aren't positive integers and there various logically + technically implications in regard where and in which tool it's used and which kind of handling respectively returning results are regarded as expected or not. A good starting point to dive deeper would be:

Modulo - Wikipedia

Without any special reason I suggest to ensure that all parameters are positive integers (applying ceil/floor() and abs() and/or alt() or range-functions to the parameters) or using another logic to get the needed results.