on 03-26-2014 11:34 PM
Hi Rey,
Understanding that you have a fixed maximum of 3 columns/value with any additional values to be ignored, you could use the following SQL syntax.
In terms of performance this should be suitable for small data sets. If you expect a high percentage of rows exceeding the 3 values (ie ROW_NUM > 3) you could also add a having clause to limit the ROW_NUM to 3 to reduce the inner data set and optimise performance.
I believe we cannot use "MAX" in the graphical modelling (I cannot find a way!) so I am looking at how to code this in CE functions however I am challenged to have the row_number function (Window Function) in a CE function. Does anybody know if (and have an example) we can use a Window Function within a CE function? I find limited documentation on the Window Functions implementation.
SQL sytanx
SELECT "OBJ_NO",
MAX(CASE WHEN ROW_NUM=1 THEN "VALUE" ELSE NULL END) AS VALUE_1,
MAX(CASE WHEN ROW_NUM=2 THEN "VALUE" ELSE NULL END) AS VALUE_2,
MAX(CASE WHEN ROW_NUM=3 THEN "VALUE" ELSE NULL END) AS VALUE_3
FROM (
SELECT "OBJ_NO", "VALUE", row_number () over (partition by "OBJ_NO") as ROW_NUM
FROM SOURCETABLE
ORDER BY "OBJ_NO" )
GROUP BY "OBJ_NO";
Cheers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Window functions are not available in any graphical models. Also, and related - window functions (currently) execute in the row store, not the column store - so performance may suffer depending on data volume.
- I'd encourage you to read the link provided . You essentially are flattening out a parent-child hierarchy. This can be accomplished on-the-fly if modeled correctly (parent-child hierarchy in Attribute or Calculation View) with good performance. You'll need a front-end tool that can query via MDX like AAO.
Otherwise you'll have to flatten manually via an ETL-type process. Sounds like that's not an option for you though.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
11 | |
10 | |
9 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.