Forum Discussion

Ryukatan10's avatar
Ryukatan10
Regular Visitor
4 years ago
Solved

Considering Specific Days Between Two Dates

Hello everyone, I'm stuck with this issue and don't know how to solve it.   I have a database that show several rows like this one:   Flight Acft Mon Tue Wed Thu Fri Sat Sun Begin Ope...
  • tamerj1's avatar
    4 years ago

    Ryukatan10 
    Here is a sample file with the solution https://www.dropbox.com/t/08giOHP4Wl2Oy6Q7

    You need first to unpivote the weekday columns in the flights table:

    Rename the "Value" column

    Delete the "Attribute" column 

    Filter out Zero values

    Create the relationship with the Date table (Make sure the Weekday numbering system is the same in both tables). In your real data the relationship will be Many to Many

    Create the table visual (Flight > from Flights table and Date > from Date table)

    Create the Filter measure that will filter only the existing Dates between "Begining" and "End"

     

     

     

     

    Flight Dates = 
    COUNTROWS ( 
        FILTER (  
            'Date',
            'Date'[Date] >= MAX( Flights[Begin Operation] )
                && 'Date'[Date] <= MAX ( Flights[End Operation] )
        )
    )

     

     

     

     

    Place the measure in the Filter Pane and select "Is not blank" then apply