Forum Discussion

powerlight1's avatar
powerlight1
Icon for Helper I rankHelper I
1 year ago
Solved

Help with Filtering Using A Separate Table

Hi, I need help with filtering using a separate table and calculating an average based on filtered records.   I have a Sales table Date, Sales 1/11/2024, 1 2/11/2024, 2 3/11/2024, 3 4/11/2024,...
  • Shahid12523's avatar
    1 year ago

    Your slicer table isn’t filtering Sales, so the average uses all 6 days.

     

    Fix: Create a measure with TREATAS

     

    Avg Sales by Slicer =
    CALCULATE(
    AVERAGE(Sales[Sales]),
    TREATAS(VALUES(slicer_date[Date]), Sales[Date])
    )


    Now the slicer dates will filter Sales, and the average for 1–5 Nov will return 3.

     

    Alternative: just relate slicer_date[Date] → Sales[Date] directly.