6

Example Table:

Date, CustomerID
2020-01-01,a
2020-01-01,b
2020-01-01,c
2020-01-02,a
[...]
2020-01-31,a
2020-01-31,b
2020-01-31,c
2020-01-31,d
2020-02-01,a
2020-02-01,b
[...]

Let's say I have a date range set on 2020-01-01 - 2020-01-31.

Id like to calculate the difference between:

(count_distinct(CustomerId) with filter Date=2020-01-01) - (count_distinct(CustomerId) with filter Date=2020-01-31) and get the result 1. 

I've tried MAX(Date) and MIN(Date), however I can't find a way to use that as a filter.

When connecting to big query i can use @DS_START_DATE, but I'd like to use this inside of data studio.

Is this possible? Thank you.

David Beck
  • 975
  • 8
  • 12

1 Answers1

-1

Perhaps you can accomplish this with creating three formula fields?

MIN(Date), MAX(Date) and then another formula field for the difference between the two.

Not sure if that would work for your data set but it came to mind.

Steven Carlton
  • 422
  • 4
  • 23
  • 2
    Do you mean: StartDate : MIN(Date) ; EndDate : MAX(Date) ; And then DATE_DIFF ? That casts Invalid formula :( But great idea. – David Beck Apr 23 '20 at 03:05