Closed john-nexkey closed 3 years ago
hi @john-nexkey! Could you please post the parent query and the param values you're passing in to the drillDown
method?
Same issue here:
This is roughly what the code looks like.
query: {
measures: ['Groups.count'],
timeDimensions: [
{
dimension: 'Groups.createdAt',
dateRange: 'This month',
granularity: 'month',
},
],
order: {
'Groups.count': 'desc',
},
dimensions: ['Org.name'],
},
resultSet.drillDown({
xValues: ['GroupA'],
});
I have been manually applying the time dimensions to get around this.
@MattGson thanks for the details. Looks like you're passing the wrong params. Actually, you shouldn't create the xValues/yValues
manually but rather take them from the pivot
(or chartPivot
) result as the values you're passing are later mapped to the pivotConfig
.
The default pivotConfig
in your case would be
{
x: ['Groups.createdAt.month'],
y: ['Org.name', 'measures']
}
As you can see the drill down params can't be properly mapped in your case.
You can find a comprehensive example here https://cube.dev/blog/introducing-a-drill-down-table-api-in-cubejs/
Hi @vasilev-alex. In my case, my query is designed with the intent output to a pie chart, so I am not grouping in my timeDimensions
query: {
measures: ['Groups.count'],
timeDimensions: [
{
dimension: 'Groups.createdAt',
dateRange: 'Last 7 days',
},
],
order: {
'Groups.count': 'desc',
},
dimensions: ['Org.name'],
},
As a result I have been unable to use a technique similar to what's used in the drill down example. Is there another approach I might consider to this? I would prefer to use timeDimensions to define time here as opposed to a time filter in order to be able to leverage relative time values.
@john-nexkey thanks! That makes sense.
... I would prefer to use timeDimensions to define time here as opposed to a time filter in order to be able to leverage relative time values.
Looks like a feature request. I think we can support relative time values for time filters. Could you post another issue, please?
Describe the bug resultSet.drillDown method does not automatically apply timeDimensions from the parent query to the drill down query
To Reproduce Steps to reproduce the behavior: Exactly the same issue as what we saw in (https://github.com/cube-js/cube.js/issues/1138) but in this case timeDimensions.
Expected behavior resultSet.drillDown method applies the timeDimensions from the parent query to the drill down query as well.