Sorting dimensions

42 views
Skip to first unread message

Sébastien Le Bail

unread,
Nov 29, 2016, 6:33:57 AM11/29/16
to Cubes
Hi all,

I'm new on Cubes and OLAP (but I successfully installed Cubes and configured a model to analyse my data). Everything is working fine and my data are properly display and filtered when using CubesViewer to view the data.
I've just only one problem : I can't figure out how to sort the dimensions to display the chart in a way that the X axis is sorted (this is very problematic for dates !). I'm fighting with this issue since 3 days and still can't find how to sort dimensions.

This is how I defined the 'depdate3' dimension in my model :

{
"name": "depdate3",
"label": "Departure date",
"info": {
"cv-datefilter": true,
"cv-datefilter-hierarchy": "daily"
},
"role": "time",
"levels": [
{ "name": "dep_year", "label": "Dep Year", "role": "year", "label_attribute": "year", "key": "year", "attributes": ["year"]},
{ "name": "dep_month", "label": "Dep Month", "role": "month", "label_attribute": "month", "key": "month", "attributes": ["month"]},
{ "name": "dep_day", "label": "Dep Day", "role": "day", "label_attribute": "day", "key": "day", "attributes": ["day"]}
],
"hierarchies": [
{
"name": "daily",
"label": "Daily",
"levels": [ "dep_year", "dep_month", "dep_day"]
}
]
}

Columns in DB (postgres) of table depdate3 are  :

id_dep_date ; year ; month ; day
2016-10-13  ; 2016 ; 10    ; 13
2016-10-14  ; 2016 ; 10    ; 14
2016-08-28  ; 2016 ; 8     ; 28
...
...

The cube is referencing the depdate3  table with :

...
"dimensions": [..., "depdate3", ...]
...
"joins":[
            {"master": "bikerides3.id_dep_date", "detail": "depdate3.id_dep_date"},
                 ...
]
...


When display a bar chart with 'Departure Date/Dep Day' as horizontal dimension bar are ordered like this :

2016/10/13    2016/10/20   2016/10/15   ...   2016/10/14  ...   2016/8/28...


Any idea to help me ?
Thanks a lot,

        Seb

Boris Tseytlin

unread,
May 25, 2017, 10:07:05 AM5/25/17
to Cubes
Facing the same problem!
Reply all
Reply to author
Forward
0 new messages