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

Special IF formular

Hello Together,

I am looking for an IF formula that returns 0 if the result of the following formula is greater than 0, otherwise it should return the result of the formula.

 

formular:

sum( if(
aggr(sum( {$<[CostType Art] = {'ERLÖS'}, Fahrttyp={'Zustellung'}>} [Betrag netto (BETNTO)]),[SendungsID (SDGID)],[SDG (DATUM)])
>0,
aggr(sum( {$<[CostType Art] = {'ERLÖS'}, Fahrttyp={'Zustellung'}>} [Betrag netto (BETNTO)]),[SendungsID (SDGID)],[SDG (DATUM)])
,
aggr(sum( {$< Fahrttyp={'Zustellung'}>} [SDG ATTR_VORBEWERT]),[SendungsID (SDGID)],[SDG (DATUM)])
)
)

-


Sum( {$<[CostTypeNr (COSTTYPE)] = {'12','13','14'}>} if( [FahrtID Fahrt (FARID)]=[FahrtID AbrechnungsLA (FARID)], [Betrag netto (BETNTO)]))
+
(
Sum( {$<[CostTypeNr (COSTTYPE)] = {'15'}, Fahrttyp={'Zustellung'} >} [Betrag netto (BETNTO)])
+
Sum( {$<[CostTypeNr (COSTTYPE)] = {'16'}, Fahrttyp={'Zustellung'} >} [Betrag netto (BETNTO)])
+
Sum( {$<[CostTypeNr (COSTTYPE)] = {'14'}, Fahrttyp={'Zustellung'}>}
if( [FahrtID Fahrt (FARID)]=[FahrtID AbrechnungsLA (FARID)],[Betrag netto (BETNTO)]))
)
+
(Sum( {$<[CostTypeNr (COSTTYPE)] = {'11','12','13'}, Fahrttyp = {'Zustellung'} >}
if( [FahrtID Fahrt (FARID)]=[FahrtID AbrechnungsLA (FARID)],0,
if(len([FahrtID AbrechnungsLA (FARID)])=0,0,
[Betrag netto (BETNTO)])))
)

 

 

 

 

 

thank you for your support & a successful year 2021!

Labels (4)
1 Solution

Accepted Solutions
Primrose
Contributor III
Contributor III

Hi @AlanM,

You can use If( [your formula] >0, 0, [your formula]). It's going to be a long expression. You may add your formula to a variable and use the variable in the expression. This is purely for visual purposes and will not enhance performance.

Hope this helps.

View solution in original post

2 Replies
Primrose
Contributor III
Contributor III

Hi @AlanM,

You can use If( [your formula] >0, 0, [your formula]). It's going to be a long expression. You may add your formula to a variable and use the variable in the expression. This is purely for visual purposes and will not enhance performance.

Hope this helps.

AlanM
Contributor II
Contributor II
Author

Hi Primrose,

thanks for the fast answer. I was struggling with a bracket problem, but is now taken care of.

Good idea with the variables, thank you very much..