Passing Date Filter into Pivot Formula
- 12-03-2022
Hi mbottai ,
I have one idea how we can create this with a formula. But we need a duplicate of the "Date" field, which we use as a dashboard filter.
Fields that I used:- Date - a field that is a dashboard filter.
- Date_dup - a copy of the Date field. I used it for aggregation.
- DateNum - int field for the date ("20221203").
- ShipCountry - dimension field for the pivot.
- Freight - field for the measure.
That's the sample of the formula for begin measure.
I have made an aggregation on the Date_Dub field and I'am trying to implement the following logic.
For example, we have the following selection in the dashboard filter:And we have a table with values for each day:
If we go into the first ship country "Argentina" we should go through each date (Date_dup) and check, whether this date is equal to minimum date in the selection.
How do we find the minimum date in a selection?
Here we see this part where we find the min DateNum with all value filters for Date_Dup and for ShipCountry:( min([DateNum]), All([ShipCountry]) , All([Days in Date_dup]) )
This is done to ignore the aggregation to get the entire dates.
So, in the case where the current date is not equal to the minimum date, it means that we do not have values for this dimension and that date, and we will get 0. Otherwise, we will get the freight.
For the end date, we have a similar formula:Sum([Days in Date_dup], if( max([DateNum])= (max([DateNum]),All([ShipCountry]),All([Days in Date_dup])) ,sum([Freight]) ,0 ) )
Kind regards,
Angelina from QBeeQ
[email protected]