简体   繁体   中英

SSAS - How to connect a Time Dimension to a DateTime attribute?

I created a Time Dimension by using SSAS Dimension Wizard. It works well, I can browse it easily.

在此输入图像描述

However, I would like to connect this dimension to a "createdAt" attribute of type DateTime from my fact table.

This is an extract of my FactTable 在此输入图像描述

Then, I linked the dimension to the fact table : 在此输入图像描述

I don't understand how to process to connect the new dimension table to the attribute. Each time I process my cube I get this error :

Erreurs dans le moteur de stockage OLAP : Clé d'attribut introuvable lors du traitement de : Table : 'dbo_Sale', Colonne : 'createdAt', Valeur : '01/01/2014 08:58:17'. L'attribut est 'Date'.

It seems an Attribute Key is missing during the process. Any idea ? Should I convert type createdAt attribute to another format ?

I would truncate the time portion of your createdAt column, eg by using a double CAST function eg

CAST ( CAST ( createdAt AS DATE ) AS DATETIME ) AS createdAt

Then the values should match your Dimension Keys.

  1. In the data source view, right click the table with 'createdAt' column and click "New Named Calculation".
  2. Give your column a name. I will call it here createdAtDate. Add the following in the Expression:

    cast(createdAt as date)

  3. In the dimension usage, set the relationship as Regular and use the new defined calculated column createdAtDate instead of createdAt.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM