EDGEANALYTIX, LLC
  • Home
  • SalesForce Solutions
  • Non-Profits
  • Analytics Lab
  • Testimonials
  • About
  • Home
  • SalesForce Solutions
  • Non-Profits
  • Analytics Lab
  • Testimonials
  • About

Analytics Lab:

A blog series distilling QUANTITATIVE data concepts AND USE-CASES IN THE EINSTEIN ANALYTICS PLATFORM.

Filter and grouping bindings for compact SAQL.

7/14/2020

0 Comments

 
I like the flexibility of the non-compact SAQL, however when it comes to having flexible groupings using bindings, I haven't had much success in using the non-compact form so below is the code for the aggregateflex compact form. Let's say you want a table that shows revenues but you want to create a toggle switch composed of 'region' , 'sales office' and  'country'. One day you want to see revenues by 'region' so table will have 2 columns (region and revenues), other times you want to see it by region and country--ie 3 columns >  region , country and revenue.. and so on. this can be accomplised by creating a query, loading the dataset, creating groups, then tweaking the "grouping" by inserting a binding. Code below has 2 bindings- a string filter for fiscal period and grouping. BOTH are selection bindings. Be aware of the line  "groups": "{{column(static_3.selection,[\"Valu\"]).asObject()}}",

When using the UI, groups will resolve to [], you need to take out the [] so it does not expect a list.


  {
                            "query": {
                                "measures": [
                                    [
                                        "sum",
                                        "GP_IOT__c"
                                    ]
                                ],
                                "groups": "{{column(static_3.selection,[\"Valu\"]).asObject()}}",
                                "filters": [
                                    [
                                        "IoT_Fiscal_Period__c",
                                        [
                                            "{{column(cFiscalPeriod_3.selection,[\"FiscalPeriod\"]).asObject()}}"
                                        ],
                                        "=="
                                    ]
                                ]
                            }
                        },
                        {
                            "query": {
                                "measures": [
                                    [
                                        "count",
                                        "*"
                                    ]
                                ],
                                "formula": "B - A",
                                "groups": "{{column(static_3.selection,[\"Valu\"]).asObject()}}"
                            },
                            "header": "GP$ Delta"
                        },
 
0 Comments



Leave a Reply.

    Author

    Write something about yourself. No need to be fancy, just an overview.

    Archives

    October 2020
    September 2020
    August 2020
    July 2020
    June 2020
    May 2020
    March 2020
    January 2020
    December 2019
    November 2019

    Categories

    All

    RSS Feed

Site powered by Weebly. Managed by Hostwinds