Skip to main content
Announcements
YOUR OPINION MATTERS! Please take the Qlik Experience survey you received via email. Survey ends June 14.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set analysis for IF

Hi,

Is there any alternate way for below IF condition? looking for set analysis.

if(Trad_PRODUCT_TYPE = 'OTC Derivative', sum(Trad_UNREALIZED_PL), if(Trad_PRODUCT_TYPE = 'SFT',sum(Trad_COLLATERAL_VALUE),sum(Trad_CURR_BOOK_VALUE)))

Thank you,

12 Replies
alkesh_sharma
Creator III
Creator III

Try This,

SUM({<Trad_PRODUCT_TYPE = {'OTC Derivative'}>}Trad_UNREALIZED_PL)+

SUM({<Trad_PRODUCT_TYPE = {'SFT'}>}Trad_COLLATERAL_VALUE)+

SUM({<Trad_PRODUCT_TYPE -= {'SFT','OTC Derivative''}>}Trad_CURR_BOOK_VALUE)

Not applicable
Author

try this

Sum({<Trad_PRODUCT_TYPE ='OTC Derivative'>} Trad_UNREALIZED_PL)

+

Sum({<Trad_PRODUCT_TYPE ='SFT'>} Trad_COLLATERAL_VALUE)

+

Sum({<Trad_PRODUCT_TYPE ='SFT'>} Trad_CURR_BOOK_VALUE)



amit_saini
Master III
Master III

Hi,

Try like this:

Sum({<Trad_PRODUCT_TYPE ={"OTC Derivative"}>} Trad_UNREALIZED_PL)

+

Sum({<Trad_PRODUCT_TYPE ={"SFT"}>} Trad_COLLATERAL_VALUE)

+

Sum({<Trad_PRODUCT_TYPE ={"SFT"}>} Trad_CURR_BOOK_VALUE)

Thanks,
AS

Not applicable
Author

Hi,

Its not worked out with these set expression.

my selections are: AFS-HTM
DF Bank
OTC Derivative
PM Loan
SFT

Expre:

if(Trad_PRODUCT_TYPE = 'OTC Derivative', sum(Trad_UNREALIZED_PL), if(Trad_PRODUCT_TYPE = 'SFT',sum(Trad_COLLATERAL_VALUE),sum(Trad_CURR_BOOK_VALUE)))

Thank you

its_anandrjs

Try this way

=Sum({<Trad_PRODUCT_TYPE ={'OTC Derivative'}>} Trad_UNREALIZED_PL)

+

Sum({<Trad_PRODUCT_TYPE ={'SFT'}>} Trad_COLLATERAL_VALUE)

+

Sum({<Trad_PRODUCT_TYPE ={''OTC Derivative''}>} Trad_CURR_BOOK_VALUE)

Regards,

Aannd

amit_saini
Master III
Master III

Raj,

Please note that for Set analysis:

- The selection may be the current one ($ sign), the database (1), a bookmark or a group. The current

selection is the default selection, the $ may be omitted.

- There is no comma (,) between the set and the measure name

- The dimension or the measure name must be enclosed into brackets [] if the name contains specific

characters like a space, a hyphen - …

- Members are always enclosed into curly brackets {} : whatever the way to find them (by name, by

search string, by a function)

- Named members are separated with a comma (,)

- Numeric member names are not enclosed into single or double quotes

- Text members are enclosed into single or double quotes but not necessarily if they do not contain

specific characters like spaces

Ex: {<MANUFACTURER_LDESC = {"AMBOISE","BELLE"}, CATEGORY_LDESC={"ACC", "COLD PLATES

”}>}

Ex: {<MANUFACTURER_KEY = {253, 2789, 1200}, CATEGORY_LDESC={"ACC", "COLD PLATES”}>}

Thanks,
AS

jagan
Luminary Alumni
Luminary Alumni

Hi Raj,

The best approach is to handle this in script like below

TableName:

LOAD

*,

if(Trad_PRODUCT_TYPE = 'OTC Derivative', Trad_UNREALIZED_PL,

if(Trad_PRODUCT_TYPE = 'SFT',Trad_COLLATERAL_VALUE,Trad_CURR_BOOK_VALUE)) AS CalcValue

FROM DataSource;


Now in charts you can straighaway use Sum(CalcValue)



OR


Sum(Match(Pick(Match(Trad_PRODUCT_TYPE, 'OTC Derivative', 'SFT', '*'),

Trad_UNREALIZED_PL, Trad_COLLATERAL_VALUE, Trad_CURR_BOOK_VALUE))


Hope this helps you.


Regards,

Jagan.


Not applicable
Author

Hi Jagan,

Chart option is not working out, let me try script part.

Thank you.

Not applicable
Author

Hi Jagan,

Result is changing by keeping if statement part in script.

Thank you.