Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi there,
I wonder how can I filter out entries from the loaded data. From my data I want to discriminate all users that have count of distinct dates > 2. So In this case I want to drop all information from U1 and in *all* the reports work only with U2 and U3
My data looks like this:
User Area Date
U1 A1 2017-08-11
U1 A2 2017-08-12
U1 A1 2017-08-13
U1 A1 2017-08-14
U2 A1 2017-08-12
U3 A5 2017-08-12
Thanks in advance for the help.
Perfect explanation.
Another question: I do not understand how the inner join changes if you do not require an aggr function. Lets say I just want the entries where date betweeen x and y.
Hi Belia,
I don't understand your question. Regarding Aggr please be aware that this function is not available in script. It is a UI function that creates an in-memory array like a straight table with one expression and one or more dimensions.
When you talk of date between x and y then you should add a where condition when loading your data like
WHERE Date >= x AND Date <=y.
If you want to consider users whose number of distinct dates lie between two values then
LOAD
User
Where CntDate >= x AND CntDate <=y;
LOAD
User,
count(DISTINCT Date) as CntDate
Resident Data Group by User;
Regards
Andrew
Hi Andrew,
Actually what I want to try is to filter by date WHERE Date >= '2017-08-11' AND Date <='2017-08-13' but filter out all the entries of the user´s that don´t fulfill the condition. In this case, U1 has a good entry but it should be discriminated and return only the records for U2 and U3. I was thinking something like calculating the Min and Max Dates for each User, but my example based in your previous answer doesnt work. Any suggestions?
I tried with:
Inner Join (Data)
LOAD
User, Date
WHERE MinD > '2017-09-01' and maxD < '2017-09-05';
LOAD User, Datum, min(date(Date)) as MinD, max(Date) as MaxD
Resident Data Group by User;
User Area Date
U1 A1 2017-08-11
U1 A2 2017-08-12
U1 A1 2017-08-13
U1 A1 2017-08-14
U2 A1 2017-08-12
U3 A5 2017-08-12
I got it. The problem was loading Date in the Outer Load. Can you explain, how this affects the load execution?