Meliorainsights.com
  • Home
  • Tableau CRM
  • Blog
  • Non-Profits
  • Our Clients
  • About
  • Trading Studio

​Meliora Insights, LLC

​Data Cloud | CRM Analytics  (TCRM / Einstein Analytics) Consulting
​meliora - 'for the pursuit of the better'


A blog series distilling quantitative concepts /use-cases in CRM Analytics  (Einstein Analytics).

Picture

Filter and grouping bindings for compact SAQL.

3/3/2021

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.

    Archives

    June 2025
    April 2025
    January 2025
    November 2024
    August 2024
    April 2024
    March 2024
    February 2024
    January 2024
    December 2023
    June 2023
    May 2023
    April 2023
    March 2023
    February 2023
    December 2022
    October 2022
    September 2022
    July 2022
    April 2022
    March 2022
    January 2022
    November 2021
    June 2021
    April 2021
    March 2021

Site powered by Weebly. Managed by Hostwinds
  • Home
  • Tableau CRM
  • Blog
  • Non-Profits
  • Our Clients
  • About
  • Trading Studio