I am working to shift calculations being performed in Tableau to be performed in an underlying SAS query and I am having a hard time recreating the Tableau Level of Detail function FIXED. Here's an example: { FIXED [ID_Field], [Group]: MAX([Value_Field]) } The tableau calculation is saying Find the MAX of the Value_Field for each individual's ID_Field in each Group
I tried to replicate this using a subquery so my query looked and operated something like this
Proc SQL; Create table XYZ.Tableau_Calcs AS
SELECT
Value Field
,ID_Field
,(Select MAX(Value_Field)
From XYX.Original_Calcs
group by ID_Field, Group) as SAS_Calc
,Group
,Date
,Flag
From XYX.Original_Calcs
However, I got an error message "ERROR: Subquery evaluated to more than one row." Apparently that means it's producing more than one line
Does anyone know how to fix this error? Here's some data that has the same structure as the data I'm dealing with at work.
Value_Field | ID_Field | Group | Date | Flag |
---|---|---|---|---|
56 | 25193T4010 | H5 | 10/31/2018 | 1 |
56 | 25193T4010 | H5 | 1/28/2019 | 1 |
38 | 25193T4010 | N9 | 2/9/2019 | 0 |
38 | 73437H0904 | E3 | 7/6/2017 | 1 |
38 | 73437H0904 | E3 | 3/14/2017 | 1 |
48 | 73437H0904 | H5 | 8/14/2018 | 1 |
48 | 73437H0904 | H5 | 10/15/2018 | 1 |
66 | 91641V2912 | H5 | 10/1/2018 | 0 |
66 | 91641V2912 | H5 | 11/1/2019 | 1 |
98 | 91641V2912 | N9 | 3/1/2019 | 1 |
98 | 91641V2912 | N9 | 3/1/2019 | 1 |