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

condition in Pivot Table between 2 dimensions

Hi the Qlik Community,

I've a problem about something, and I hope you can help me to solve it ?

I have an excel file, and in the file, there are somes dimensions : the Date, a reference ,an evolution of stock, and some modifications about this stock (Sell and rectification).

I'm looking for a formula which can tell me if a modification on the stock put the stock under Zero during 1 week.

for example, I have this king of table:

DateReferenceStockRectificationsells
01/08refA2000
02/08refA20-100
03/08refA1005
04/08refA507
05/08refA-200
01/08refB2000
02/08refB20-100
03/08refB10020
04/08refB-1005
05/08refB-1500

I'm looking for something like that:

DatereferenceBinairy
05/08refA1
04/08refB1
05/08refB1

I already search with getFieldSelections, and some set analysis but it's not helpfull...

if anyone has a great idea, it will be so nice !!

thank you in advance

Louis

4 Replies
MindaugasBacius
Partner - Specialist III
Partner - Specialist III

I have two solutions:

1. With flag that is created in the load sentence;

2. Without the flag with data we have.

Screenshot_3.png

Please take a look at the attachment.

MarcoWedel

maybe

LOAD *,

          -(Stock<0) as Binary

From Yourtable;

?

hope this helps

regards

Marco

louisernould
Contributor III
Contributor III
Author

Hi Marco and Mindaugas,

First, thank for your quick answers, you're working faster than me

Both of your solutions work to see how many reference has a stock <0. But I'm looking for the condition which can tell me if I have a stock <0 And a rectification  > 0 (at least one) a week before.

for this example, it will return nothing : I have a Stock <0 on 05/08, but no rectification.

DateReferenceStockRectificationsells
01/08refA1000
02/08refA1000
03/08refA1005
04/08refA507
05/08refA-200

Otherwise, for this example,

DateReferenceStockRectificationsells
01/08refA1000
02/08refA10100
03/08refA005
04/08refA-507
05/08refA-1200

It will return

DatereferenceBinairy
04/08refA1
05/08refA1

Hope your can still help me

regards,

Louis

Or
MVP
MVP

Perhaps something along the lines of:

If(Stock < 0 AND aggr(sum(Rectification,Reference))>0,1) ?

This isn't specific to one week - it will check your entire selected date population. If you need it to specifically check one week back, you'll need to look into a range function / inter-record function instead.