简体   繁体   中英

How to use the unique items from in a column from several tables as the row criteria of a pivot table in excel data model using Dax?

I have 3 different tables with the customer name and there are duplicates as well as unique customers in the 3 tables and I need to get the unique for all 3 to be used as the rows criteria in the pivot table.

I've been finding a way to do so but I cannot seem to figure it out.

The measure I tried is: Customers:=DISTINCT(UNION(VALUES('Test1 - Invoice'[CustomerID]),VALUES('Test2 - Invoice'[CustomerID]),VALUES('Test3 - Invoice'[CustomerID])))

But I get the error below:

Semantic Error: Too many arguments were passed to the VALUES function. The maximum argument count for the function is 1.

I am quite new to DAX and have no idea how to do it. I believe it is because measures are only for values if i'm not mistaken

I read that to place on other fields of the pivot table, it has to be a calculated column although I do not see how it can be a calculated column as well.

One approach is to create a separate table to store the Customer Name dimension - then create relationships between that Customer dimension table and your 3 fact tables. This would be most effective at the Power Query stage, but can be done using DAX.

An alternative is to merge your 3 fact tables - again, this would be best done with Power Query, but is possible with DAX.

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