Why won't my data sheet look like my SQL query?

42 views Asked by At

I am trying to model a Tableau data sheet table with a stored procedure(SQL SELECT query).

Here my stored procedure(SQL SELECT query):

SELECT el.planetID, el.planetSessionID, termAbv,
ISNULL(testResults, 'Inconclusive') AS testResults,
chemicalTimeStamp  AS timeStarted, 
chemicalTimeStamp AS timeFinished
FROM fullChemicalLog el JOIN fullTraceList ui ON el.traceID = ui.traceID 
LEFT OUTER JOIN chemicalTraceList tn ON el.planetSessionID = tn.planetSessionID
WHERE el.planetID = '22400ab8-62a2-4a69-b002-5dd4d0459728'
AND isDeleted <> 1
GROUP BY el.planetID, chemicalTimeStamp, termAbv, el.traceID, el.chemicalType, el.planetSessionID, testResults
ORDER BY termAbv, el.planetSessionID,  timeStarted, timeFinished DESC

And my results insde the SMSS query viewer:

planetSessionID termAbv     testResults         timeFinished            timeStarted
1               Generic     Inconclusive        12/14/2022 1:57:36 PM   12/14/2022 1:57:36 PM
2               Generic     End of Test         2/28/2023 10:18:57 PM   2/28/2023 10:18:57 PM
3               Generic     Inconclusive        3/1/2023 10:52:39 AM    3/1/2023 11:04:41 AM
4               Jones       End of Test         2/28/2023 10:18:57 PM   2/28/2023 10:18:57 PM
5               Generic     Inconclusive        2/26/2023 9:29:47 PM    2/26/2023 9:29:47 PM
6               Generic     End of Test         12/12/2022 2:37:14 PM   12/12/2022 2:37:21 PM
7               Generic     Inconclusive        12/12/2022 9:14:37 AM   12/12/2022 9:14:37 AM
8               Jones       End of Test         11/7/2022 11:51:58 AM   11/7/2022 11:51:58 AM
9               Jones       Inconclusive        2/28/2023 10:45:27 PM   2/28/2023 10:46:54 PM

So inside Tableau desktop, I made a new Book and used my MS SQL Server connection.

Then I picked the correct database and stored procedure and update the data.

Afterwards, I made a new data sheet and dragged over the same data points I use in my SQL Query.

However when I view the results in Tableau, everything looks messed up as seen here:

planetSessionID termAbv testResults         timeFinished            timeStarted
3               Generic     Inconclusive        3/1/2023 10:52:39 AM    3/1/2023 11:04:41 AM
7               Generic     Inconclusive        *                       *
6               Generic     End of Test         *                       *
9               Jones       Inconclusive        *                       *
5               Generic     Inconclusive        2/26/2023 9:29:47 PM    2/26/2023 9:29:47 PM
4               Jones       End of Test         *                       *
2               Generic     End of Test         2/28/2023 10:18:57 PM   2/28/2023 10:18:57 PM
8               Jones       End of Test         11/7/2022 11:51:58 AM   11/7/2022 11:51:58 AM
1               Generic     Inconclusive        *                       *


And if I try to order the planetSessionID, it moves but it's just a different out-of-order list.

I also can't figure out how to fix the times because some have `*` instead of the date and time string.

I am certain I am being dumb and not understand how to fix this in Tableau.

Are there any toughts?

Thank you friend!
0

There are 0 answers