Forum Discussion

MJEnnis's avatar
MJEnnis
Resolver III
1 year ago
Solved

Using another table (e.g., holidays) to filter a calendar table

I am trying to use a holiday table to filter a calendar table that already filters other tables and measures. When the applied filter is both directions, the calendar table correctly filters the holi...
  • MJEnnis's avatar
    MJEnnis
    1 year ago

    Figured it out! Your complex selector post was helpful, but the solution was much simpler in my case. I have a measure that calculates the total number of any given product available on any given calendar day, considering the start and end season for each product. All I had to do was tell my existing measures to return a blank if the [units available] measure was blank. Works like a charm, as you can see below. Still have no clue why it replaces all other dates with 0 without this condition. But not going to rack my brain anymore... 😄 Thanks again! Just chatting with you seems to lead me to a solution everytime!

    New measure (guess I will test if the first condition is redundant now, since it already passes through [units available]):

    Vacancy = 
    
    Var OPEN_Date = MIN('Lista Tipologie delle Risorse'[InizioStagione])
    Var Close_Date = MAX('Lista Tipologie delle Risorse'[FineStagione])
    Var d = MAX('Calendar'[Date])
    
    VAR vacancy_ = [Units Available] - [Occupancy]
    
    RETURN IF(d < OPEN_Date || d > Close_Date, BLANK(), IF(ISBLANK([Units Available]), BLANK(),vacancy_))


    Screenshot of it working: