Pages

Friday, December 27, 2019

Einstein Analytics: Working with Null Dimension with Default Value

A dimension field in Einstein Analytics is equal to a string field. However, by default Einstein Analytics does not show NULL value in grouping or sorting.

From the sample report below, we have 1004 accounts, and 5 of them do not have Account Source.



With dataflow, we get all the Account from Salesforce to Einstein Analytics, this clearly shows the number of Accounts in the dataset is 1004.



Then, let us group it by Account Source



Notice from the above screenshot, Accounts with null Account Source do not show at all, the same if we change it to Compare Table.



In Values Table, Account with null Account Source still appears.


But, if we sort by Account Source column, the rows will no longer show.


So, instead of keeping it null, we can transform the value as N/A in Einstein Analytics. We can do this from sfdcDigest note in Dataflow.
Open the sfdcDigest node for Account and click the pencil icon next to Account Source.



In the Default Value, populate N/A, and click the Save button.



Notice the pencil icon next to Account Source is changed, this tells us that something has been updated for that field, click Save button again to close sfdcDigest window.



If you check the dataflow JSON, defaultValue is added

"sfdcDigest_Account": {
    "action": "sfdcDigest",
    "parameters": {
      "fields": [
        {
          "name": "Id"
        },
        {
          "name": "Name"
        },
        {
          "name": "AccountSource",
          "defaultValue": "N/A"
        }
      ],
      "object": "Account"
    }
}


Now, update the dataflow and run it again, then group the lens with Account Source, notice N/A added for all null values Account Source.




No comments:

Post a Comment