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

Load script from MS SQL database is appending data instead of overwriting?

Hi All,

New to QV, so this may be a dumb question, but in my load script I have the following:

ODBC CONNEC TO (DBName) (XUserId is asdfasdfasdfasdfasd);
Load TechID,
        TechName,
        TickStatus,
        Counts;
[TicketSummary]:
SELECT DISTINCT T.TechID, E.TechName, T.TickStatus, Count(T.TickStatus) as 'Counts'
FROM TickTable T
     JOIN Employee E on T.TechID=E.TechID
WHERE MONTH(T.SchedDate)=MONTH(GetDate()) and YEAR(T.SchedDate)=YEAR(GetDate())
GROUP BY T.TechID, E.TechName, T.TickStatus   

The expected data - and the results of the query directly against the DB in SSMS - looks like this (5 rows):

0001    Bob    Pending    75

0001    Bob    Done          120

0002    Mark    Pending    46

0002    Mark    Done          96

0002    Mark    Canceled    3

The query worked great last month, the first month I had this set up. But now that we've moved into November,  I get 12 rows of data, 7 of which have the October counts. Copying the SQL query exactly as is into SSMS only gives me 5 rows.

Any idea what would be causing this? Even if I go to File->Reduce Data->Remove all Values to clear everything out and then reload, I still get the 12 rows of data.

1 Reply
Not applicable
Author

‌Using Table viewer, I was able to find the issue. Another table in my load script had a 'TickStatus' column as well, and QV was relating that table to the one loaded in my question above. for some reason they'd get joined together in my pivot table object.

After modifying the column name the issue went away.