in packages/timebrush-powerbi/src/TimeBrushVisual.ts [237:265]
private loadSelectedRangeFromPowerBI(dataView: powerbi.DataView, hasDataChanged: boolean, state: TimeBrushState) {
let startDate: Date;
let endDate: Date;
const {dataSourceChanged, filterStartDate, filterEndDate} = this.parseDatesFromPowerBi(dataView, hasDataChanged);
if (filterStartDate && filterEndDate) {
// If the user indicates whether or not to clear the selection when the underlying dataset has changed
const updateSelection = !dataSourceChanged || !state.clearSelectionOnDataChange;
if (updateSelection) {
startDate = coerceDate(filterStartDate);
endDate = coerceDate(filterEndDate);
let range: [Date, Date] = [] as [Date, Date];
if (startDate && endDate) {
range = [startDate, endDate];
}
this.timeBrush.selectedRange = range;
} else {
this.timeBrush.selectedRange = undefined;
}
state.selectedRange = this.timeBrush.selectedRange;
} else if (dataView) {
state.selectedRange = undefined;
}
}