Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Loop and reduce function

Hello,

I have a question regarding the loop and reduce function. I use it in several application and it works fine. But now I have the following situation:

I have two tables:

Orders:

- Company

- Order

- Date

- Item

- Quantity

Forecast

- Item

- Date

- Quantity

They are linked through the item and the date. That makes it possible to compare the sold quantity with the origin forecast.

When I loop and reduce the application per company, I only received the forecast of the dates which exists in the orders table as well. I lose the forecast values in the future.

Is it possible to exclude the forecast table in the script for the reduce function? Like I could exclude the filter with fix set analysis in diagrams!?

3 Replies
vgutkovsky
Master II
Master II

Well it seems to me that's what will always happen if you link on Date. Rather, if your second table is for forecasting, you should only be linking on Item. Rename Date from Forecast to [Forecast Date] or something. It's not possible to exclude a table from a loop-and-reduce; even if it were possible though, it would not be a very elegant solution. You would typically want to avoid synthetic key situations like the one you're introducing here. Once the data model is revised a little your problems should go away.

Regards,

Not applicable
Author

Hello,

thanks for your response. I think you are right with the recommendation. Of course my data model is not that easy as described in the example, but I will try to merge the "two" tables and ignore the date.

Regards,

Bernd

vgutkovsky
Master II
Master II

I don't know of any way to set patterns on only some bars or to adjust the bars width. Maybe you can play with the new Gandtt chart available in v10, it might work better for you. Meanwhile, I'm attaching the solution that I mentioned before that I made from some fake data--I think it's a very decent view and you can easily tell from the legend what the red bars represent.

Regards,