Forum Discussion

gselvag's avatar
gselvag
Icon for Helper I rankHelper I
8 years ago
Solved

DAX with calculation between start and finish dates

Hi,   I need a expert advice on how to create a calculated column or measure. The challange I have is with following table.   Table 1 (fact table): Name (Text type) StartDate (Date/Time type) ...
  • v-yulgu-msft's avatar
    v-yulgu-msft
    8 years ago

    Hi gselvag,

     

    First, create a calendar table to list unique continual dates.

    Calendar date = CALENDAR(MIN('Fact Table'[StartDate]),MAX('Fact Table'[FinishDate]))

    Then, create a calculated table via cross join FACT table and above calendar table. And add a calculated column.

    Cross Join =
    FILTER (
        CROSSJOIN ( 'Fact Table', 'Calendar date' ),
        [Date] >= 'Fact Table'[StartDate]
            && [Date] < 'Fact Table'[FinishDate]
    )

    Month Name = 'Cross Join'[Date].[Month]

     

    Use a Matrix visual to display data records from above table.

     

    Best regards,

    Yuliana Gu