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.

date range filter

1/22/2020

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.

    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