Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Our May 2021 end-to-end product release from Data Integration to Data Analytics is out! READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Applicable88
Creator III
Creator III

If-Statement in a table dimension cannot filter over magnifying glass

Hello,

I have two date times. One is Inbound and the other one outbound. So the logic is, if the inbound time exist and there is also a outbound time, i know the material is not anymore in the inventory:

if(inboundtime>0 and outboundtime>0, 'Given out on" & [Outboundtime]

As you can see, instead of showing me only the time, there is the information 'given out on' included. 

Now the next condition is when there is a inboundtime and NO outboundtime (outboundtime is Null), I know for sure the material is still in my inventory. So put altogether I have this:

if([inboundtime]>0 and isNull([outboundtime]),'in inventory',
if([inboundtime]>0 and [ountboundtime]>0 , 'given out on ' & [outboundtime]))

So far as a simple dimension it works pretty well. I have many already given out fields which I can chose exactly the date and qlik is filtering accordingly. 

But when I chose the field 'in Inventory' which exist in the search only one time, then I get a confused mix of results and not only those which are still in inventory. I think the if-statement cannot use this way maybe. Anyone has a tip for me?

Thank you in advance.

Best. 

 

1 Solution

Accepted Solutions
jyothish8807
Master II
Master II

The challenge here i believe is, your calculated dimension the custom value do not have proper association with complete data model. 

Can you try this expression once:

if(len(trim([inboundtime])) > 0 and len(trim([outboundtime]))=0,'in inventory',
if(len(trim([inboundtime])) >0 andlen(trim([outboundtime])) >0 , 'given out on ' & [outboundtime]))

Best Regards,
KC

View solution in original post

3 Replies
jyothish8807
Master II
Master II

Hi,

 

Try creating this field in the script and use the field as dimension directly. You will get the right values in serches then.

 

Load

*,

if([inboundtime]>0 and isNull([outboundtime]),'in inventory',
if([inboundtime]>0 and [ountboundtime]>0 , 'given out on ' & [outboundtime]))  as NewDimension

from <>;

 

Br,
KC

Best Regards,
KC
Applicable88
Creator III
Creator III
Author

@jyothish8807 , thanks for the quick reply. But that way its not going to work. The problem is the inboundtime and the outboundtime are coming from two different sources. So when you put the load script into one of the source it either will say it cannot find inboundtime or cannot find outboundtime. Depending if I put the script to the source of inboundtime or either outboundtime. 

Is there a another way? 

jyothish8807
Master II
Master II

The challenge here i believe is, your calculated dimension the custom value do not have proper association with complete data model. 

Can you try this expression once:

if(len(trim([inboundtime])) > 0 and len(trim([outboundtime]))=0,'in inventory',
if(len(trim([inboundtime])) >0 andlen(trim([outboundtime])) >0 , 'given out on ' & [outboundtime]))

Best Regards,
KC

View solution in original post