Anthony stark Posted August 1, 2019 Share Posted August 1, 2019 Hi Guys, Im trying to build this squery as an spotifre expression: SELECT COUNT (CRAFT) AS COUNT, WORKID FROM LABOR GROUP BY WORKID HAVING COUNT>1 How do i translate this to a spotfire expression Thanks in advance Link to comment Share on other sites More sharing options...
Colin Gray 3 Posted August 1, 2019 Share Posted August 1, 2019 Hithere, For the equivalent of group by expressions you normally use OVER statements in Spotfire (although many visuals such as cross tables will do this on the fly for you). The help on OVER statementshas some good examples if you search for OVER in the help and take a look at 'in advanced custom expressions', 'in calculated columns' and 'in custom expressions'. For you example, you could do something like: Count([CRAFT]) Over ([WORKID]) Which should mimic the SQL statement you have. You can wrap this in an IF statement perphaps or add it as a data limiting expression on a chart to mimic the HAVING expression. So the expression as a filter to your chart (by adding limited data by expression from the Data option): Count([CRAFT]) Over ([WORKID]) > 1 If you want to wrap it in an IF you could do: IF(Count([CRAFT]) Over ([WORKID]) > 1,Count([CRAFT]) Over ([WORKID]), NULL). Or create it as a calculated column in your data table then you can simple do: IF([My New Column]>1, [My New Column], NULL) Hope this helps, Colin Link to comment Share on other sites More sharing options...
Anthony stark Posted August 1, 2019 Author Share Posted August 1, 2019 Thanks Colin! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now