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

Need a Help in If condition

Hi Friends,

I am having a problem with IF Condition Could some one can please help me in resolving Issue

Formula is Available in Text Object in Attached qvw  Please It's very Important. It will be really Appreciable if some one helps me

Please find attached documents

Thank you,

Swarupaaa

9 Replies
santiago_respane
Specialist
Specialist

Hi,

i think your IF statement is not well formed.

Maybe you can share what is your desired result in order to give you a more accurate solution.

Try this:

=if(len([Updated Date]) = 0,1,

    if((Place = 'South' or Place = 'North') AND

       [Updated Date] <=(FirstWorkDate([Finalised Date],[No of Days],$(Test_Holidays))) AND

    ([Place Code] = 'D21'  AND [Place Code] = 'M01'),0,1))

Let me know if this helps.

Kind regards,

squeakie_pig
Creator II
Creator II

Something like this might be what you are looking for

if(len([Updated Date]) = 0, 1,

if(match(Place, 'South','North') AND [Updated Date] <=(FirstWorkDate([Finalised Date],[No of Days],$(Test_Holidays))) AND match([Place Code], 'D21''M01'),

0,1))

It's not very clear what you're looking for though.

squeakie_pig
Creator II
Creator II

Also, do you need the Place = North and South if you are using Place Code.  In the sample you provided the Place Codes made this redundant, so the code below might be sufficient

=if(len([Updated Date]) = 0, 1,

if(match([Place Code],'D21','M01') AND [Updated Date] <=(FirstWorkDate([Finalised Date],[No of Days],$(Test_Holidays))),

0,1))

Not applicable
Author

Thank you for your response Santiago I will check and Let you know

Not applicable
Author

Hi Collete,

I have written code what you mentioned in script

Test:

LOAD [Updated Date],

     [Finalised Date],

     Place,

     [Place Code],

     [No of Days],

if(len([Updated Date]) = 0, 1,

if(match(Place, 'South','North') AND [Updated Date] <=(FirstWorkDate([Finalised Date],[No of Days],$(Test_Holidays))) AND match([Place Code], 'D21''M01'),

0,1)) as [Test]

FROM

xyz.qvw

It have to show 0,1 for Test. But it's showing only 1

Not applicable
Author

Actual Formula is

IF([Updated Date]="","1",

  IF(AND([Place Code]="North",[Updated Date]<=(WORKDAY([Finalised Date],-6,Holiday)),(LEFT([Place Code],3)="D21")),"0",

    IF(AND(LEFT([Place Code],3)="M01",[Updated Date]<=WORKDAY([Finalised Date],-6,Holiday)),"0",

      IF(AND([Place Code]="South",[Updated Date]<=(WORKDAY([Finalised Date],-6,Holiday)),(LEFT([Place Code],3)="D21")),"0",

        IF(AND(LEFT([Place Code],3)="M01",[Updated Date]<=WORKDAY([Finalised Date],-6,Holiday)),"0","1")))))

Thank you for your reply Collete

Not applicable
Author

IF([Updated Date]="","1",

  IF(AND([Place Code]="North",[Updated Date]<=(WORKDAY([Finalised Date],-6,Holiday)),(LEFT([Place Code],3)="D21")),"0",

    IF(AND(LEFT([Place Code],3)="M01",[Updated Date]<=WORKDAY([Finalised Date],-6,Holiday)),"0",

      IF(AND([Place Code]="South",[Updated Date]<=(WORKDAY([Finalised Date],-6,Holiday)),(LEFT([Place Code],3)="D21")),"0",

        IF(AND(LEFT([Place Code],3)="M01",[Updated Date]<=WORKDAY([Finalised Date],-6,Holiday)),"0","1")))))

Thank you for your reply Santiago. It is formula from excel

squeakie_pig
Creator II
Creator II

Is there any values that meet the criteria for 0, from what I can tell they are all 1.... but it's been a long day so I could have misinterpreted a comma in there somewhere

Not applicable
Author

Thank you Kenny