There is no default metric for getting the count of posts from Facebook, but you can generate this value with a custom calculated field in Data Studio. Here's step-by-step instructions of how to set this up!
- Click the edit icon for the Facebook Insights data source to bring up the field list.
- Click + ADD A FIELD to bring up the calculated field dialog.
- In Field Name, give the calculated field a meaningful name.
- In the Formula field, add the following:
SUM(CASE WHEN Post ID IS NULL THEN 0 ELSE 1 END )
Example of a completed field configuration:
You can also use COUNT(Post ID):
- Click SAVE to store the custom field.
- You can now add it as a "metric" type field to your report elements!
This custom field will behave like a metric, but it's not actually a metric field request to the data source. It is still handled as a "Post ID" dimension by Facebook.
So if you use it alone without another metric, such as in a scorecard, you will get the error that "no metric is selected" as it's not legal to request the dimension without at least one metric. You can work around this in some cases with the following type of formula, which adds a true metric to the request.
This basically adds and subtracts the metric value so that its included in the request but not actually impacting the value of the count.
Do be aware that for some reason this does not work for all users - you may see an error that you cannot re-aggregate an already aggregated value. If that happens, you won't be able to use this workaround and will need to include the count field you created in a table or other report object that allows for metrics to be selected.