Sometimes, one needs to unfilter twice in a project based on different assumptions.
```
read "/sample/orders.csv" as Orders expect [date] with //dates in the past
"OrderDate" as date : date
Quantity : number
show linechart "Daily Orders" a1c2 {seriesType: "stack"} with
sum(Orders.Quantity)
group into Day // table 'Day' auto-created after 'expect [date]'
span date = [today()..today()+365] //dates in the future
...
```
The previous script fails because span is not allowed to drop lines, it can only add new lines.
One must filter the Day table first to drop any existing data that would be outside the intended span.
```
read "/sample/orders.csv" as Orders expect [date] with //dates in the past
"OrderDate" as date : date
Quantity : number
show linechart "Daily Orders" a1c2 {seriesType: "stack"} with
sum(Orders.Quantity)
group into Day // table 'Day' auto-created after 'expect [date]'
where date >= today() //filtering first the current Day table
span date = [today()..today()+365] //dates in the future
...
```
Sometimes, one needs to unfilter twice in a project based on different assumptions.
```
read "/sample/orders.csv" as Orders expect [date] with //dates in the past
"OrderDate" as date : date
Quantity : number
show linechart "Daily Orders" a1c2 {seriesType: "stack"} with
sum(Orders.Quantity)
group into Day // table 'Day' auto-created after 'expect [date]'
span date = [today()..today()+365] //dates in the future
...
```
The previous script fails because
span
is not allowed to drop lines, it can only add new lines.One must filter the
Day
table first to drop any existing data that would be outside the intended span.```
read "/sample/orders.csv" as Orders expect [date] with //dates in the past
"OrderDate" as date : date
Quantity : number
show linechart "Daily Orders" a1c2 {seriesType: "stack"} with
sum(Orders.Quantity)
group into Day // table 'Day' auto-created after 'expect [date]'
where date >= today() //filtering first the current Day table
span date = [today()..today()+365] //dates in the future
...
```