简体   繁体   English

Power Pivot 2010:DAX,具有重叠的动态组

[英]Power Pivot 2010: DAX, Dynamic Groups with Overlap

How do I use Power Pivot to summarize data in groups which are defined in a separate, non-relatable table 如何使用Power Pivot将数据汇总到一个单独的,不可关联的表中定义的组中

I'm analyzing a database that has the following tables: 我正在分析具有以下表的数据库:

Sales
  Store
  Category
  Units
  Sales
Stores
  Store
  address
  etc
StoreGroups
  Store
  Group

A store can be in multiple groups (ie store B762 is in NW group & control_group) hence the StoreGroup table - where the two fields together make the primary key. 一个商店可以在多个组中(即,商店B762在NW组和control_group中),因此可以使用StoreGroup表-两个字段共同构成主键。 Therefore, I can't relate StoreGroups to my Sales table, because both have duplicate Store values. 因此,我无法将StoreGroups与我的Sales表相关联,因为两者都有重复的Store值。

Right now all stores are being reported in each group: PivotTableScreenshot 现在,每个组中的所有商店都将被报告: PivotTableScreenshot

to confirm, if a store is in two groups, its sales should get counted for BOTH groups ie control group and NWRegion. 要确认,如果一家商店分为两个组, 则应将其销售计入两个组,即对照组和NWRegion。

I've tried to adapt this DAX example mentioned below but have not been successful: http://www.daxpatterns.com/dynamic-segmentation/ 我试图改编下面提到的DAX示例,但没有成功: http : //www.daxpatterns.com/dynamic-segmentation/

You have a many-to-many relationship between stores and groups. 您在商店和组之间具有多对多关系。

You should be able to create a relationship from the store in StoreGroups and the Store in Stores (StoreGroups is a bridge table). 您应该能够从StoreGroups中的商店和Stores中的商店创建关系(StoreGroups是一个桥接表)。

If you can post a link to some sample data, that would be helpful. 如果您可以发布一些示例数据的链接,那将很有帮助。

After doing that, you can read start to read about writing DAX formulas for many-to-many scenarios here . 完成此操作后,您可以在此处阅读开始阅读,以了解有关为多对多场景编写DAX公式的信息 Be sure to also read in the comments, especially the one from Marco Russo. 一定还要阅读评论,尤其是Marco Russo的评论。

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

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