Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
ajaykumar1
Creator III
Creator III

Need 'If' help !!!

Hi Everyone,

I have the small req like below and attached the sameple data as well and i have to develop the same at design level.

If ACTUAL BALANCE is -ve then we have to replace with 0 for all the products.

If PRODUCTS FD/RD have blank then we have replace TARGET BALANCE by ACTUAL BALANCE along with the above condition.

The sample output has been attached.

Thanks,

Ajay

1 Solution

Accepted Solutions
venkatg6759
Creator III
Creator III

Check the attachment

View solution in original post

10 Replies
Not applicable

EDITED

I think this is what you're looking for....see attached

TEST:

LOAD * INLINE

[

ITEM,ACTUALBALANCE,TARGETBALANCE,TYPE

100,-980,,CA

101,345,4564,SA

102,454,56563,CA

103,-230,2525,SA

104,-42344,,FD

105,25252,,RD

106,4524525,,FD

107,78787,,RD

108,5878,,FD

109,4554,1234,SA

110,456,535,CA

];

TEST2:

LOAD

ITEM,

if(ACTUALBALANCE < 0, 0, ACTUALBALANCE) as ACTUAL,

TYPE,

if(TYPE = 'FD' OR TYPE = 'RD', if(ACTUALBALANCE < 0, 0, ACTUALBALANCE), TARGETBALANCE)AS TARGET

RESIDENT TEST;

DROP TABLE TEST;

ajaykumar1
Creator III
Creator III
Author

Any hint from anyone...

ajaykumar1
Creator III
Creator III
Author

Thanks Christian...Its good..But i have to develop the same in Design level.Because all the fields are coming from various qvd's in data model.

Thanks,

Ajay

Not applicable

Updated sample, not sure if this is still off but hopefully leads you in the right direction.

ajaykumar1
Creator III
Creator III
Author

Any suggestions from anyone....

Thanks,

Dhanu

its_anandrjs

Let me know what do you mean by Design level (it is on front end or may be it is on load script level).

ajaykumar1
Creator III
Creator III
Author

We need to develop at front end.

venkatg6759
Creator III
Creator III

Check the attachment

its_anandrjs

On the straight table write Dimension expression like

Dimension:- Item

Dimension:- Type

Exper(For Actual):- if(sum( ACTUALBALANCE) < 0 ,0, sum(ACTUALBALANCE))

Exper(For TARGET):- if(TYPE = 'FD' OR TYPE = 'RD', if(sum(ACTUALBALANCE) < 0, 0, sum(ACTUALBALANCE)), Sum(TARGETBALANCE))