Forum Discussion

powerlight1's avatar
powerlight1
Helper I
11 months ago
Solved

How to Filter Using a Separate Table

Hi Community, I am doing some complex calculation and "OR Condition" filtering and need some help.   I have a simple table called Baseline with date and sales: Date Baseline Sales 1/11/202...
  • MFelix's avatar
    11 months ago

    Hi  , 

    For this I believe you do not need to have two calendar tables.

     

    What I modeled was the following:

    • Created a calendar table
      • Needs to start at 1st of January of the minimum year and end at 31 of December of maximum year
      • Be carefull to check the dates between both the sales and the baseline
      • In this case the calendar goes from January 1st 2024 to  31st December 2024
      • Create a one to many between the tables:
        • Calendar - Baseline
        • Calendar - Actual
        • Create the measures below:
          • AVG_Baseline_Sales = CALCULATE( AVERAGE(Baseline[Baseline Sales]), ALL('Calendar'[Date] )) AVG_Baseline_Sales2 = CALCULATE( AVERAGE(Baseline[Baseline Sales]) )Use the calendar table in your slicer
          • Result below

             

            The relationship will pick up the baselines corretly now you can also do a average of the sales and add the date to the visualization:

             

            If you want to keep the average for the 5 days you can create a measure similar to this one:AVG_Baseline_Sales 3 = CALCULATE( AVERAGE(Baseline[Baseline Sales]), ALLSELECTED('Calendar'[Date] )) 

            Please see attach file.