简体   繁体   English

PowerPivot-无法创建一对多关系-错误:类型不匹配

[英]PowerPivot - Cannot create one to many relationship - Error: Type mismatch

I have created a data model in Excel 2013 which consists of two queries: 我在Excel 2013中创建了一个数据模型,该模型包含两个查询:

  1. Table with 1 million rows of data. 具有一百万行数据的表。 One of columns stores information on CUSTOMER_ID. 列之一存储有关CUSTOMER_ID的信息。
  2. Table with 600 rows of data. 具有600行数据的表。 This is a list of distinct CUSTOMER_IDs, but only VIP accounts. 这是不同的CUSTOMER_ID的列表,但只有VIP帐户。

I wanted to create a one to many relationship between these CUSTOMER_ID columns but when I try to do so, I get the following error: 我想在这些CUSTOMER_ID列之间创建一对多关系,但是当我尝试这样做时,出现以下错误:

============================
Error Message:
============================

The following system error occurred:  Type mismatch. 
Cannot convert value 'D: ControlTechSK4633-1' of type Text to type Integer.

----------------------------
The following system error occurred:  Type mismatch. 
Cannot convert value 'D: ControlTechSK4633-1' of type Text to type Integer.


============================
Call Stack:
============================

   at Microsoft.AnalysisServices.BackEnd.DataModelingSandbox.ExecuteCaptureLogAndProcessResults(OperationType type, Boolean cancellable, Boolean raw, Boolean raiseEvents)
   at Microsoft.AnalysisServices.BackEnd.DataModelingSandbox.ExecuteAMOCode(OperationType type, OperationCancellability cancellable, AMOCode code, Boolean raiseEvents)
   at Microsoft.AnalysisServices.BackEnd.SandboxTransaction.CommitUpdates()
   at Microsoft.AnalysisServices.BackEnd.SandboxTransaction.CommitInternal(Boolean finalCommit)
----------------------------
   at Microsoft.AnalysisServices.BackEnd.SandboxTransaction.CommitInternal(Boolean finalCommit)
   at Microsoft.AnalysisServices.Common.RelationshipController.CreateRelationship(DataModelingColumn sourceColumn, DataModelingColumn relatedColumn)
   at Microsoft.AnalysisServices.Common.RelationshipController.formCreateRelationshipDialog_Confirming(Object sender, EventArgs e)
   at Microsoft.AnalysisServices.Common.CreateRelationshipDialog.buttonOK_Click(Object sender, EventArgs e)

============================

Thank you in advance for the help. 预先感谢您的帮助。

To me it appears that the Customer_ID is formatted as Text in the one table, but not in the other. 在我看来,在一个表中,Customer_ID的格式设置为文本,而在另一表中则没有。 If so, is there a way to have the field formatted the same way in both sources? 如果是这样,是否可以在两个源中以相同的方式格式化字段?

If not, you may be able to get around it by using the FORMAT function in a calculated column (in the table that has numbers formatted as text). 如果不是这样,则可以通过使用计算列(在具有数字格式为文本格式的表中)中的FORMAT函数来解决此问题。 You could then use that calculated column for your join/relationship. 然后,您可以使用该计算出的列作为联接/关系。

Some info on the Format function: http://social.technet.microsoft.com/wiki/contents/articles/685.power-bi-dax-text-functions.aspx 有关“格式”功能的一些信息: http : //social.technet.microsoft.com/wiki/contents/articles/685.power-bi-dax-text-functions.aspx

Edit: Also, I just realized that this error may be caused if you have a text value in a column that is numeric. 编辑:另外,我只是意识到,如果在数字列中有文本值,则可能会导致此错误。 You may need to review your data to see if that scenario exists. 您可能需要查看数据以查看是否存在该情况。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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