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

repetative values.


Hey data i've imported contains several duplications, I've tried distinct load but to no luck. could you please suggest some course of actions to remove the duplications?

at present it looks something like...

balanceCurrent      |   balanceFuture        |   PostingDate     |        documentDate

433.50                          -230.53                      30/09/2014               30/09/2014

202.97                           -108.24                    1/09/2014                    28/06/2014

202.97                           -108.24                    1/09/2014                    28/06/2014

202.97                           -108.24                    30/09/2014                   30/09/2014

94.73                             0.00                           1/09/2014                 28/06/2014

94.73                             0.00                           1/09/2014                 28/06/2014

94.73                             0.00                           30/09/2014                 30/09/2014

thanks
Bon.

13 Replies
maxgro
MVP
MVP

see attachment

if this is your req (distinct balance)

1.png

Anonymous
Not applicable
Author

Hey Massimo,

thank you for your reply.

Yes that is something im looking for. I have tried using disctinct in the script but it still showing the same thing. should I declare it as an expression?

MarcoWedel

Hi,

distinct load seems to work for your sample data:

QlikCommunity_Thread_138888_Pic1.JPG.jpg

LOAD Distinct  * INLINE [

    balanceCurrent, balanceFuture, PostingDate, documentDate

    433.50, -230.53, 30/09/2014, 30/09/2014

    202.97, -108.24, 1/09/2014, 28/06/2014

    202.97, -108.24, 1/09/2014, 28/06/2014

    202.97, -108.24, 30/09/2014, 30/09/2014

    94.73, 0.00, 1/09/2014, 28/06/2014

    94.73, 0.00, 1/09/2014, 28/06/2014

    94.73, 0.00, 30/09/2014, 30/09/2014

];

can you post your app?

regards

Marco

Anonymous
Not applicable
Author

Hey Massimo

could you please upload a .txt instead? im using the personal edition and can no longer open other qvw's.

thanks.

Bon.

Anonymous
Not applicable
Author

Hey Marco.

thank you for your reply, my datasource is coming from a odbc, not sure if will make any difference as to what you've suggested.

MarcoWedel

there must be some difference in the values if distinct does not work.

Anonymous
Not applicable
Author

I've been trying to look for the differences but cant seem to find it. is there a way to specify that if balanceCurrent, balanceFuture, postingDate and DocumentDate matches remove the row? would that be my best approach?  or would the problem be with my calendar?

APPeriodSummary:

LOAD Distinct
balanceCurrent,
    
balanceFuture,
    
current,
    
futureBalance,
    
invoices,
    
oid as myAPPeriodSummary,
    
payments,
    
purchases,
    
totalBalance
FROM
[..\APPeriodSummary.qvd](
qvd);

APInvoice:

LOAD distinct
postingDate,
lcNetAmount,
    
oid as myAPInvoice,
    
paymentDate,
     documentDate,
     reference
FROM
[..\APInvoice.qvd](
qvd);

Temp:

Load
             
min(postingDate) as minDate,
              
max(postingDate) as maxDate
Resident APInvoice;
Let varMinDate = Num(Peek('minDate', 0, 'Temp'));
Let varMaxDate = Num(Peek('maxDate', 0, 'Temp'));
DROP Table Temp;



TempCalendar:
LOAD
             
$(varMinDate) + Iterno()-1 As Num,
              
Date($(varMinDate) + IterNo() - 1) as TempDate
              
AutoGenerate 1 While $(varMinDate) + IterNo() -1 <= $(varMaxDate);    
Load distinct
  
Dual(fYear-1 &'/'& fYear, fYear) as FYear,   // Dual fiscal year
   Dual(Month, fMonth)                as FMonth// Dual fiscal month
   Dual('Q' & Ceil(fMonth/3), Ceil(fMonth/3)) as FQuarter,
  
Ceil((postingDate-StartOfFWeekOne+1)/7) as FWeekNo,
   *;
Load Year + If(Month>=$(vFM), 1, 0)   as fYear,   // Numeric fiscal year
   Mod(Month-$(vFM), 12)+1            as fMonth// Numeric fiscal month
   Dual('Q' & Ceil(Month/3), Ceil(Month/3)) as Quarter,
  
WeekStart(FYearStart,0,$(vFD))     as StartOfFWeekOne,
   *;
MasterCalendar:
Load
              
TempDate AS postingDate,
               week(TempDate) As Week,
              
Year(TempDate) As Year,
              
Month(TempDate) As Month,
              
Day(TempDate) As Day,
              
date(monthstart(TempDate), 'MMM-YYYY') as MonthYear,
              
YearStart(TempDate,0,$(vFM)) as FYearStart,
             
Week(TempDate) & '-' & Year(TempDate) as WeekYear,
  
Dual(WeekDay(TempDate),Mod(WeekDay(TempDate-$(vFD)),7)+1) as WeekDay,
   
Date(TempDate,'MM/DD') as DATEMMDD
Resident TempCalendar
Order By TempDate ASC;
Drop Table TempCalendar;

thanks.

Bon.

maxgro
MVP
MVP

a:

load * inline [

balanceCurrent      ,   balanceFuture        ,   PostingDate     ,        documentDate

433.50   ,                       -230.53  ,                    30/09/2014   ,            30/09/2014

202.97    ,                       -108.24  ,                  1/09/2014      ,              28/06/2014

202.97     ,                      -108.24   ,                 1/09/2014       ,             28/06/2014

202.97      ,                     -108.24    ,                30/09/2014       ,            30/09/2014

94.73        ,                     0.00       ,                    1/09/2014    ,             28/06/2014

94.73         ,                    0.00        ,                   1/09/2014     ,            28/06/2014

94.73          ,                   0.00         ,                  30/09/2014     ,            30/09/2014

];

NoConcatenate

load * Resident a

where peek(balanceCurrent)<>balanceCurrent or peek(balanceFuture)<>balanceFuture

order by balanceCurrent, balanceFuture, PostingDate;

DROP Table a;

Anonymous
Not applicable
Author


Hey Massimo, thank you for that.

balanceCurrent & balanceFuture is in the PeriodSummary table, and Posting is in the Invoice table,

should i concatenate them together? or is there a better way around this?