function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Omar Mayland 1Omar Mayland 1 

Static step binding in SAQL query

Hi All,

I have two datasets: Quota and Opportunities. I want to show my sales team how far they still have to go to reach their quota. I have created a static step with Quota Levels to filter out Quotas from the Quota dataset. I want my widget to respond by filtering out the relevant quota when I select a quota level, but I cant seem to get this working.
This is my static step:
"Quota_Level_1": {
                "type": "staticflex",
                "values": [
                    {
                        "display": "CFO",
                        "value": "CFO"
                    },
                    {
                        "display": "Sales Director",
                        "value": "Sales Director"
                    },
                    {
                        "display": "Account Executive",
                        "value": "Account Executive"
                    }
This is the step to create the gauge widget:
"all_1": {
                "datasets": [
                    {
                        "id": "0Fb0P00000005nuSAA",
                        "label": "User Allocation",
                        "name": "quota1",
                        "url": "/services/data/v39.0/wave/datasets/0Fb0P00000005nuSAA"
                    },
                    {
                        "id": "0Fb0P00000005nsSAA",
                        "label": "Opportunities",
                        "name": "opportunity1",
                        "url": "/services/data/v39.0/wave/datasets/0Fb0P00000005nsSAA"
                    }
                ],
                "isFacet": true,
                "isGlobal": false,
                "query": {
                    "pigql": "q = load \"quota1\";\nq = filter q by {{cell(timeperiod_list.selection, 0, \"current\").asDateRange(\"date('StartDate_Year', 'StartDate_Month', 'StartDate_Day')\")}};\nr = load \"opportunity1\";\nr = filter r by {{cell(timeperiod_list.selection, 0, \"current\").asDateRange(\"date('CloseDate_Year', 'CloseDate_Month', 'CloseDate_Day')\")}};\nr = filter r by 'IsWon' == \"true\";\nr = filter r by 'IsClosed' == \"true\";\nq = group q by all, r by all;\nq = foreach q generate sum(r.Total_Annual_Amount__c)/sum(q.QuotaAmount)*100 as 'sum_QuotaAttainment';\nq = limit q 2000;",
                    "measures": [
                        [
                            "count",
                            "*",
                            "sum_QuotaAttainment"
                        ]
                    ],
                    "measuresMap": {
                        "sum_QuotaAttainment": [
                            "count",
                            "*",
                            "sum_QuotaAttainment"
                        ]
                    },
                    "groups": []
                },
                "selectMode": "single",
                "type": "aggregateflex",
                "useGlobal": true,
                "visualizationParameters": {
                    "options": {}
                }
            }
User-added image

Any ideas on how to get this working?
Best Answer chosen by Omar Mayland 1
SaahilLakhaniSaahilLakhani
Try adding this to the pigql step: 
q = filter q by {{column(Quota_Level_1.selection, [\"value\"]).asEquality(\"value\")}};