Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

if statement in qlikview

how can we write this if statement in qlikview



If "Collateral or Scrip" = "Trades" And
If "Borrower or Lender" = "Lender" Then
Market Value = -Qty * Market Price Else
Market Value = Qty * Market Price

If "Collateral or Scrip" = "Collateral" and "Security ID" = "Cash"
Then If "Borrower or Lender" = "Borrower"
Market Value = -Qty Else
Market Value = Qty

ElseIf "Security ID" <> "Cash" and
"Borrower or Lender" = "Borrower" Then
Market Value = -Qty *  Market Price Else
Market Value = Qty * Market Price

3 Replies

Re: if statement in qlikview

‌please post sample application.

regards

Marco

Re: if statement in qlikview

May be like this

Load *,

If("Collateral or Scrip" = "Trades",

     If ("Borrower or Lender" = "Lender",

                -Qty * "Market Price",

               Qty * "Market Price"

     ),

     If( "Collateral or Scrip" = "Collateral" and "Security ID" = "Cash",

          If( "Borrower or Lender" = "Borrower",

                    -Qty,

                    Qty

          ),

          If( "Security ID" <> "Cash" and "Borrower or Lender" = "Borrower",

                    -Qty *  "Market Price",

                    Qty * "Market Price"

          )

     )

) AS Market Value

FROM Source;

effinty2112
Honored Contributor

Re: if statement in qlikview

Try this:

Pick(Match([Collateral or Scrip],'Trades','Collateral'),

//[Collateral or Scrip] ='Trades'

If([Borrower or Lender] = 'Lender',[Market Value] = -Qty * [Market Price], [Market Value] = Qty * [Market Price])

,

//[Collateral or Scrip] ='Collateral'

If([Security ID] = 'Cash',

If([Borrower or Lender] = 'Borrower', [Market Value] = -Qty, [Market Value] = Qty),

If([Borrower or Lender] = 'Borrower', [Market Value] = -Qty * [Market Price], [Market Value] = Qty * Market Price)