Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
davyqliks
Specialist
Specialist

If statement with wild match in load script

HI All,

I hope you are able to assist.

I am trying to import write an if wildmatch statement with some multiplication in my load script. the syntax is correct however i am not getting the desired result. here is my load statement:

 

Load

if(
WildMatch([Share of fabric in the style (shell fabric) 4] , '*PADDING*') and WildMatch(Fibre ,'*GRS') and
[Share of fabric in the style (percentage) 4]/100 * [Share of sustainable quality in the fibre(percentage) 2]/100 * Percentage/100 >=1 ,

'We Care',

'Not Sustainable')

as [We Care]

FROM [lib://Qlik Sense E Drive/Live/~~~~~/QVD's/AllData.QVD]
(qvd);

 

As you can see i need to multiply 3 dimensions and if they match the stated values (*PADDING) and (*GRS) and are equal to or greater than 1, name as We Care, if not all of the above name as Not Sustainable.

 

As mentioned i thought this was working well however i have an instance where the multiplication result is .3 and yet the result is still We Care when i have specified it must be over 1.

this makes me believe something in the way i have written is not correct.

Can anyone advise on if my syntax is correct for ALL of the variables to be met to be we care?

Thank you for your time in advance,

Daniel

Labels (4)
1 Solution

Accepted Solutions
Kushal_Chawda

@davyqliks  try below

if(
WildMatch([Share of fabric in the style (shell fabric) 4] , '*PADDING*') and WildMatch(Fibre ,'*GRS') and
(([Share of fabric in the style (percentage) 4]/100 )* ([Share of sustainable quality in the fibre(percentage) 2]/100) *( Percentage/100)) >=1 ,

'We Care',

'Not Sustainable')

as [We Care]

View solution in original post

4 Replies
Kushal_Chawda

@davyqliks  try below

if(
WildMatch([Share of fabric in the style (shell fabric) 4] , '*PADDING*') and WildMatch(Fibre ,'*GRS') and
(([Share of fabric in the style (percentage) 4]/100 )* ([Share of sustainable quality in the fibre(percentage) 2]/100) *( Percentage/100)) >=1 ,

'We Care',

'Not Sustainable')

as [We Care]

davyqliks
Specialist
Specialist
Author

Thanks you for the reply and suggestion.

I am a little confused.

in the load i have added this: 

Load
*,


if(
WildMatch([Share of fabric in the style (shell fabric) 2] , 'LINING') and WildMatch(Fibre ,'Polyester GRS') and
(([Share of fabric in the style (percentage) 1]/100 )*([Share of sustainable quality in the fibre(percentage) 1]/100) *( Percentage/100)) >=.2 ,

'We Care', 'Not Sustainable'


)
as [We Care]

and i get the following:

davyqliks_0-1628586232126.png

If i add the if statement to the table as a measure i get the following:

davyqliks_1-1628586313143.png

 

But if i remove the fibre from the table i get the following with the measure in the table:

davyqliks_2-1628586368673.png

and this from the load script:

davyqliks_3-1628586416882.png

 

do you have any idea why i might be getting these mixed results.

Thanks so much for your help on this @Kushal_Chawda 

 

Daniel

 

Kushal_Chawda

@davyqliks  You have created that field in script which you cannot use it in measure. You need to use it in dimension. Check that you are getting correct values for all required condition.

davyqliks
Specialist
Specialist
Author

Thank you,

This does work in principle but i have so many variables i need to put another layer of matching in place or i get cross over results, but thank you so much for the reply and for your time.

Regards,