Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
vijayit43
Creator
Creator

More Than One value in if statement

We use Week Filter In Qv Report when select Week-1 then sum (IndentQty*20/100)  when Select Week-2 then Sum (IndentQty*25/100) as so on,  Its Working fine For me but when we select Week-1 and Week-2 Both then Filter Not apply My expression is Given below Please help,

if(WEEK='WEEK-1',Sum((IINDENTQTY*20)/100),
if(WEEK='WEEK-2',Sum((IINDENTQTY*25)/100),
if(WEEK='WEEK-3',Sum((IINDENTQTY*25)/100),
if(WEEK='WEEK-4',Sum((IINDENTQTY*30)/100),
if(WEEK ='WEEK-1,WEEK-2',Sum((IINDENTQTY*45)/100),sum(IINDENTQTY))))))

1 Solution

Accepted Solutions
qlikoqlik
Creator
Creator

HI Vijay

I have sorted this by creating a variable to store the value of the selected value from the list box and an if formula as an expression

variable: WeekValue=Concat(distinct WEEK,',')

Expression:

if(WeekValue='Week-1',sum(IINDENTQTY)*0.2,
if(WeekValue='Week-2' or WeekValue='Week-3',sum(IINDENTQTY)*0.25,
if(WeekValue='Week-4',sum(IINDENTQTY)*0.3,
if(WeekValue='Week-1,Week-2',sum(IINDENTQTY)*0.45,sum(IINDENTQTY)))))

Regards

Padma


View solution in original post

7 Replies
its_anandrjs

Try to write like

if(WEEK='WEEK-1',Sum((IINDENTQTY*20)/100),
if(WEEK='WEEK-2',Sum((IINDENTQTY*25)/100),
if(WEEK='WEEK-3',Sum((IINDENTQTY*25)/100),
if(WEEK='WEEK-4',Sum((IINDENTQTY*30)/100),
if(Match(WEEK ,'WEEK-1' , 'WEEK-2'  ),Sum((IINDENTQTY*45)/100),sum(IINDENTQTY))))))

vijayit43
Creator
Creator
Author

But Its Not Working for Me

its_anandrjs

You have to do change in the expressions and where are you using this expression in any text object or chart otherwise you have to do aggregation in the expression.

vijayit43
Creator
Creator
Author


Hi We have Attach Qv Sample please Check..

its_anandrjs

Hi Vijay,

In your data model the week field is independent in nature and it is not related to the IINDENTQTY then how you get data reflected for the QTY table please check.

Hope this helps

qlikoqlik
Creator
Creator

HI Vijay

I have sorted this by creating a variable to store the value of the selected value from the list box and an if formula as an expression

variable: WeekValue=Concat(distinct WEEK,',')

Expression:

if(WeekValue='Week-1',sum(IINDENTQTY)*0.2,
if(WeekValue='Week-2' or WeekValue='Week-3',sum(IINDENTQTY)*0.25,
if(WeekValue='Week-4',sum(IINDENTQTY)*0.3,
if(WeekValue='Week-1,Week-2',sum(IINDENTQTY)*0.45,sum(IINDENTQTY)))))

Regards

Padma


qlikoqlik
Creator
Creator

Hi

Please see attached sample tables

Week1 and 2.GIF.gif

Regards

Padma