powerbi-desktopssas-tabularssas-2012

Date table in SSAS Tabular model not working


I built an SSAS Tabular model cube and created a date table using calendarauto(). I have marked it as a date table and created a relationship with the fact table using the date column, and both columns have a Datetime data type. When I analyze the data using excel, the date filter is not working correctly. For example, when I filter on the year 2021, it gives me row values for the year 2019 also, but if I use the date column from the fact table, I get the correct results. When I analyze the Tabular cube using Power BI, it works right. Could you please suggest what exactly is going wrong with our date table?

When I put the Fact table date column and date table date column on excel it looks like the screenshot below.

enter image description here


Solution

  • First, I think that is a bad IDEA to use CALENDARAUTO because it searching for all date columns from your model (and if you have a Customer with a born date eg. 1912-02-02, then you create a big table from that date).

    CALENDARAUTO ignores calculated tables and calculated columns searching for date columns. Only the imported columns are analyzed to search for date columns.

    Internally, CALENDARAUTO calls CALENDAR providing a date range that include all the days in the range of years referenced by data in the model, according to the following rules:

    The earliest date in the model which is not in a calculated column or calculated table is taken as the MinDate. The latest date in the model which is not in a calculated column or calculated table is taken as the MaxDate. The date range returned is dates between the beginning of the fiscal year associated with MinDate and the end of the fiscal year associated with MaxDate.

    A better idea is to use CALENDAR where you have more control

    CALENDAR (
        DATE ( 2005, 1, 1 ),
        DATE ( 2015, 12, 31 )
    )
    

    To the topic. Are you sure that you make a relationship on THIS column (in your fact table)? Check also Cross Filtering Behavior -> OnDirection/BothDirection; Show your relationship detail.