Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
erric3210
Creator
Creator

Not Match Issue

Hi All,

I've a requirement to exclude Years from the Chart.

Although, my actual logic is very complex which I'm using in my Application but I created a sample to take help from you guys.

Here is the sample data:

LOAD * INLINE [
Year_Name, Flag
2022-02, NA
2022-01, NA
2021-12, NA
2021-11, NA
2021-10, NA
2021-09, A
2021-08, A
2021-07, A
2021-06, A
2021-05, A
];

Anyhow, I've to use concat in match condition in order to achieve the result but it's not working in my case.

I think I have to aggregate my expression again with using Concat & Aggr.

 

PFB the desired output snapshot:

Not match.png

Regards,

Eric

Labels (1)
1 Solution

Accepted Solutions
MarcoWedel

I think the trick to get your expression to work like you seem to expect would be to let the concat() function not only create a single string that is compared against the Year_Name values, but instead let it define the distinct match values itself. This can be done by dollar sign expanding the concat expression:

https://help.qlik.com/en-US/sense/February2022/Subsystems/Hub/Content/Sense_Hub/Scripting/dollar-sig...

I.e. in your case like this:

=IF(NOT MATCH(Year_Name,$(=CONCAT({<Flag={'NA'}>}CHR(39)&Year_Name&CHR(39),','))),Year_Name)

 

That being said, I do agree with Rob in that there surely are shorter, easier and faster (set expression) solutions than this, however complex your use case might be.

hope this helps

Marco

 

View solution in original post

6 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

How about:

Only({<Flag={'A'}>} Year_Name)

-Rob

Sivapriya_d
Creator
Creator

if there will be other values for Flag , you can try this 
If(Flag<>'NA',Year_Name)

erric3210
Creator
Creator
Author

Hi Sir,

Thanks for taking time and answering to my question.

But as I said above my actual logic is bit complex so,

I want t to generate result using something like this which are not matching:

=IF(NOT MATCH(Year_Name,CONCAT({<Flag={'NA'}>}CHR(39)&Year_Name&CHR(39),',')),Year_Name)

Hope I added some clarity here.

-Eric

MarcoWedel

I think the trick to get your expression to work like you seem to expect would be to let the concat() function not only create a single string that is compared against the Year_Name values, but instead let it define the distinct match values itself. This can be done by dollar sign expanding the concat expression:

https://help.qlik.com/en-US/sense/February2022/Subsystems/Hub/Content/Sense_Hub/Scripting/dollar-sig...

I.e. in your case like this:

=IF(NOT MATCH(Year_Name,$(=CONCAT({<Flag={'NA'}>}CHR(39)&Year_Name&CHR(39),','))),Year_Name)

 

That being said, I do agree with Rob in that there surely are shorter, easier and faster (set expression) solutions than this, however complex your use case might be.

hope this helps

Marco

 

erric3210
Creator
Creator
Author

Thanks @MarcoWedel for the solution.

Indeed it was a great learning for me.

- Eric.

erric3210
Creator
Creator
Author

Hi @MarcoWedel 

I agree that @rwunderlich logic is shorter and easier but I guess it will not work in my case.

My requirement is to exclude cases which is inside Concat() function.

- Eric