Customer Banners (Ads) - SpiceUp. AX and SpotfireX Disclaimer



If you find this site useful and you want to support, buy me a coffee   to keep this site alive and without ads.

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 numeric values from the set
min = dt.Columns["Date"].RowValues.GetMinNumericValue(rows.First)
max = dt.Columns["Date"].RowValues.GetMinNumericValue(rows.Last)

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

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})