Object properties

Lists all the available properties of the objects contained in the dynamic data definition JavaScript object.

The following tables list the properties that are available for use when defining the JavaScript object for dynamic data definition of report slicers.

Property types:

The property types of the below described properties can be: O = Optional N = Needed = May be needed under some circumstances C = Compulsory

Top-level slicer object properties

PropertyTypeDescription
nameOName of the slicer purely to help you identify the slicer.
descriptionODescription of the slicer purely to help you identify the slicer.
targetNMay be needed if there are more then one target for the slicer, in which case the target must be specified. This object has two properties - table and column - which both must EXACTLY MATCH the same properties of the slicer.
formatOThe format string to be used to format the items produced by the expression.

For example if the result of the expression is a list of dates then a format value of "ddd d MMM" will result in dates like "Friday 3 Jan".

expressionNA function that generates a value or list of values that will be checked against selectConditions to be included and selected.

NOTE that due to the way how Power BI currently works any values that the slicer selection lists are supposed to contain but not have selected must be present in the data of the underlying target table(s). The expression can generate additional values that are not present in the underlying table(s) but these will also be automatically pre-selected. Power BI currently does not seem to allow adding values to the slicer list without selecting them at the same time.

selectConditionsNIf any items generated by the expression are to be selected they must return true from running this condition expression. If the condition returns false and at the same time the value is not present in the underlying data table such value will not be present in the list.

IMPORTANT: Only values generated by expression will be checked with the selectConditions function.

The allowed values of this property are:

  • 0 (zero) = No items will be selected. (Default)
  • 'all' = All the items generated by the expression will be selected
  • N (a positive integer) = The first N items in the list generated by expression will be selected.
  • -N (a negative integer) = The last N items in the list generated by expression will be selected.
  • [an expression] = An expression that must evaluate to true or false which will usually contain a value variable representing the value being tested.
    __________
    Example: (FY(Now()) >= value < GetDate(Year(Now()), Month(Now()), 1)) || (Year(value) > 2030)

valuesNIs an array which can contain one of the following:
  • A list of arrays where each array contains one to three members which are described below in value sub-arrays properties.
  • A list of objects whose properties are listed in value objects properties below.

Lower-level object properties

target properties

PropertyTypeDescription
tableCThe name of the underlying data source table.
columnCThe name of the linked data table column.

value properties

The value property is an array of either objects or sub-arrays.

value objects properties

If the value array contains objects then these represent distinct list definitions and the first one whose condition will evaluate to true will be used to generate the value list and to select those values.

PropertyTypeDescription
conditionCAn expression which when it evaluates to true will override any properties defined in the parent object. The condition in these objects in the values list is evaluate for each of the contained objects until the evaluation returns true. When it does the evaluation of any subsequent object's condition is skipped and the current object's properties are used as overrides for the parent objects definition. The last object in this list may have the condition property omitted in which case it will be used to override the parent's properties if no other preceding object's condition property evaluated to true.

An example condition: FY(DateAdd('M', Now(), -2)) < FY(Now())

nameOOverrides the same property in the parent object.
descriptionOOverrides the same property in the parent object.
targetOOverrides the same property in the parent object.
formatOOverrides the same property in the parent object.
expressionOOverrides the same property in the parent object.
selectConditionsOOverrides the same property in the parent object.

value sub-arrays properties

If the value array contains sub-arrays then each of these sub-arrays represents a single value that the slicer should contain in its selection list.

The sub-arrays can have one to three properties like so: ["string or expression", isExpression, isSelected].

PropertyTypeDescription
string or expressionCEither a direct value expressed as a string or a string representing an expression that needs to be evaluated to get the value.
isExpressionOtrue if the string or expression is in fact an expression. Defaults to false.
isSelectedOtrue if this value should be selected. Defaults to false.