Get min and max values from a Date RangeFilter




#get list of filtered rows
dt = Document.ActiveDataTableReference
rows = Document.ActiveFilteringSelectionReference.GetSelection(dt).AsIndexSet()

#get min and max values from the set
min = dt.Columns["Date"].RowValues.GetFormattedValue(rows.First)
max = dt.Columns["Date"].RowValues.GetFormattedValue(rows.Last)

2 comments:

Anonymous said...

Is it possible to reference the min and max variables in this example in the expressions used in a visualization?

Jose Leviaguirre said...

you will need to store min and max values into a (Date) document property like this: Document.Property["myMinDateDocProp"] = min
To use it in a custom expression, do something like DateDiff('day',[myDateCol], ${myMinDateDocProp})