Forum Discussion

Deni's avatar
Deni
New Member
2 years ago

Deneb visual sorting by different measures/columns

Dear all,

I'm new in deneb. I try to do sorting based on user selection from a slicer. In the slicer I have 2 values: By group or By increase

I have 2 tables. 1 for products and 1 for categories. In the categories table I have group column. In the product table I have increase measure.

What I would like to accomplish is conditional sorting in my deneb.

Here it is what I did try but it seems I do not find the right syntax

 "layer": [
{
"mark": {
"type": "text",
"angle": -90,
"baseline": "middle",
"align": "left",
"size": 10,
"color":"grey"
},
"encoding": {
"text": {
"field": "groupdisplay",
"type": "nominal"
},
"x": {
"field": "Category",
"sort": {
"op": "mean",
"condition": {"test": "datum['selectedorder'] = 'By increase'", "value": "Value"},
"value": "groupdisplay"
},
"type": "nominal",
"axis": {
"labelAngle": -45,
"grid": true,
"offset": 10,
"title": null
}
},
"y": {
"field": "Value",
"type": "quantitative",
"axis": {"title": "Value"},
"scale": {"zero": false}
}
}
}]

 

Thank you for your help 🙂

1 Reply