Displaying data by time series aggregated by a given time period
I have data in the following format in Qlik Sense:
Date
Customer
Flag
2016-10-01
A
1
2016-10-01
B
0
2016-10-02
A
1
2016-10-02
C
1
2016-10-03
A
1
2016-10-03
B
1
2016-10-03
C
1
2016-10-05
C
1
2016-10-10
A
0
2016-10-10
B
1
2016-10-11
C
0
I would like to display the above data in a table in Qlik Sense in the following format:
Week Number
Count Distinct Customer Where Flag is 1
39
2
40
3
41
3
Logic Behind: I need Week wise count of DISTINCT Customers who have Flag = 1 in the that Week including one previous Week. So, here Week Number 40 will display distinct count for Week 39 and 40. Similarly Week 41 will display distinct count for Week 40 and 41 and so on.
I would appreciate if anyone can suggest a Qlik Sense expression for the above?