Forum Discussion

rjobaan's avatar
rjobaan
Frequent Visitor
1 year ago
Solved

filter does not work when columns are not selected

I have the following filter created filter_dates_general = VAR result = IF( SELECTEDVALUE(fct_revenue[Start_Date])>= MIN(dim_calendar[Date]) &&SELECTEDVALUE(fct_revenue[Start_Date])<=MAX(dim_cal...
  • rjobaan's avatar
    1 year ago

    that is not working. finally i find the correct code:

    filter_dates_general =
    VAR SelectedStartDate = MIN(dim_calendar[Date])
    VAR SelectedEndDate = MAX(dim_calendar[Date])
    RETURN
    CALCULATE(
    DISTINCTCOUNT(fct_revenu[DIM_Customer_ID]),
    KEEPFILTERS(
    (fct_revenu[Start_Date] >= SelectedStartDate && fct_revenu[Start_Date] <= SelectedEndDate) ||
    (fct_revenu[End_Date] >= SelectedStartDate && fct_revenu[End_Date] <= SelectedEndDate) ||
    (fct_revenu[Start_Date] <= SelectedStartDate && fct_revenu[End_Date] >= SelectedEndDate)
    )
    )