简体   繁体   中英

What is best practice for aggregating multiple congruent databases for use by Power BI

I am consolidating data from multiple, identically-structured databases that make frequent use of bigint key fields. What is best practice for ensuring uniqueness in the aggregate tables and ensuring they can still be related to the foreign keys in other aggregate tables once they're in Power BI ?

I ask because it is my understanding that Power BI won't allow joins using multiple columns.

I have created the following illustrative case:

源数据库

If Power BI were okay with me joining the aggregate Customers table to the aggregate Orders table using multiple fields, I'd simply add a source field (eg src) and do this: 使用新字段“src”聚合数据库 Note that the join between the two tables uses two fields: src and CustId

But if, as I understand it, Power BI requires that those be joined by a single field, I'd be tempted to create a new value by merging the src and CustId fields into, say, SrcCustId and joining on that: 与新的辅助字段聚合

Finally, if the answer is merging the two columns into a helper column, can I do that using a computed column in SQL Server (or SQL Database) or do I need to handle that when loading the source tables in the first place?

I would prefer the computed column solution because there may be multiple foreign keys in my actual tables and loading helper columns for all of them will blow up the amount of work I need to do each time I spin up new Azure Data Factory pipelines for a new source database.

Explanation: - Instead of merging or creating helper column you can use CombineValues function of DAX. The CombineValues function supports multi-column relationships in DirectQuery models.

Reference: - COMBINEVALUES function (DAX) - DAX | Microsoft Learn

Other option to use user defined aggregations. Aggregations in PowerBI is used to improve the performance of large DirectQuery datasets.

Power BI desktop app has provision of “Manage Aggregations” to create aggregation based on tables.

Reference: - https://learn.microsoft.com/en-us/power-bi/transform-model/aggregations-advanced

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