There is decode function in my expression and I convert this decode in qliksense expression .. and it looks like qliksense don't have keyword of decode by default
So how I convert this decode in qliksense
SUM(DECODE(Rcount,0,DECODE(H.documentno,NULL,(C.gross- C.amont),0),0))
Any help please
The equivalent of Decode
in Qlik is the if .. then .. else statement.
Your statement can be converted to:
SUM(
if( Rcount = 0,
if( isNull(H.documentno), C.gross - C.amont, 0)
,0)
)
If we start with the inner Decode
DECODE(H.documentno,NULL,(C.gross- C.amont),0)
It can be "translated" to: If H.documentno
is Null
then return C.gross- C.amont
else return 0
And the outer Decode
can be translated to: if Rcount
is 0
then return the inner Decode
statement else return 0
Bit of an warning/advice. In general if .. then .. else
statements can be slow(er) in expressions. You might not see the difference in small datasets but in big/large ones its visible. If you can move this calculation in the load script and in the frontend just Sum()
the result then the frontend calculation will be faster