Meliorainsights.com
  • Home
  • Tableau CRM
  • Field Notes
  • Non-Profits
  • Our Clients
  • About
  • Home
  • Tableau CRM
  • Field Notes
  • Non-Profits
  • Our Clients
  • About
Search

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

DATE RANGE FILTER

3/3/2021

0 Comments

 
Here is one way to filter a date range. There is a more 'proper way' which is using the .asDateRange() serialization but this works too. A awesome explanation of these bindings  is in  www.salesforceblogger.com by Rikke.  :-) 



"query": "q = load \"{{column(DistrictStep_SAFCreated.selection,[\"datasetSAF30d\"]).asObject()}}\";\nq = filter q by date('CreatedDate_Year', 'CreatedDate_Month', 'CreatedDate_Day') in [dateRange({{column(dayFilter.selection,[\"weekRange\"]).asObject()}})];\nq = group q by 'newContact' ;\nq = foreach q generate 'newContact' as 'Specialist', count() as 'SAF Last Wk';q = order q by 'SAF Last Wk' desc;\n",




You would create a static query called dayFilter and have the following in the JSON.


"dayFilter": {
                "broadcastFacet": true,
                "columns": {
                    "weekRange": {
                        "type": "string"
                    },
                    "Display": {
                        "type": "string"
                    }
                },
                "label": "",
                "selectMode": "singlerequired",
                "type": "staticflex",
                "values": [
                    {
                        "Display": "Nov24",
                        "weekRange": "[2019,11,24], [2019,11,30]"
                    },
                    {
                        "Display": "Dec1",
                        "weekRange": "[2019,12,1], [2019,12,7]"
                    },
0 Comments



Leave a Reply.

Site powered by Weebly. Managed by Hostwinds
  • Home
  • Tableau CRM
  • Field Notes
  • Non-Profits
  • Our Clients
  • About