Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Start & End Dates

I have a list of Shows with a start date and an end date. Some cross years and I need to show the total hours on a platform each month and year. So basically I need for each month a formula that say ...
  • v-yingjl's avatar
    6 years ago

    Hi Anonymous ,

    Based on your description, you can try to create this measure:

    Hours = 
    VAR _date =
        SELECTEDVALUE ( 'Calendar'[Date] )
    VAR _start =
        SELECTEDVALUE ( 'Total Programming'[Start] )
    VAR _end =
        SELECTEDVALUE ( 'Total Programming'[End] )
    RETURN
        IF (
            ISFILTERED ( 'Calendar'[Date] ),
            IF (
                _date > _start
                    && _date < _end,
                DATEDIFF ( _start, _date, HOUR ),
                "not correspond"
            ),
            "not correspond"
        )

    Attached a sample file that hopes to help you: date hours.pbix

     

    Best Regards,
    Yingjie Li

    If this post helps then please consider Accept it as the solution to help the other members find it more quickly.