PowerBI矩阵钻取时市场份额计算丢失筛选上下文问题求助
PowerBI钻取矩阵层级时市场份额度量值丢失筛选上下文问题
问题概述
在PowerBI中计算市场份额时,钻取到矩阵的产品层级后,度量值会丢失筛选器设置的筛选上下文,导致市场份额计算基数错误。
简化示例数据
销售原始数据
| Product | Sales |
|---|---|
| Product1 | 50 |
| Product2 | 30 |
| Product3 | 18 |
| Product4 | 65 |
| Product5 | 94 |
| Product6 | 20 |
| Product7 | 54 |
| Product8 | 24 |
| Product9 | 145 |
产品主数据(关联产品、类别与品牌)
| Product | Category | Brand |
|---|---|---|
| Product1 | A | Brand1 |
| Product2 | A | Brand1 |
| Product3 | A | Brand1 |
| Product4 | B | Brand2 |
| Product5 | B | Brand2 |
| Product6 | B | Brand2 |
| Product7 | A | Brand3 |
| Product8 | A | Brand3 |
| Product9 | C | Brand4 |
当前使用的度量值
用于计算MarketSize的DAX公式:
MarketSize = CALCULATE(Sum(Sales[Sales]) ,ALLEXCEPT(Sales ,ProductMaster[Category] ))
问题表现
- 在品牌层级查看份额时,该度量值计算正常;
- 钻取到品牌下的产品层级后,总市场值从355变为176,Brand1的份额从28%变为56%——此时筛选器选中的Category B的市场值被忽略;
- 需求:钻取矩阵层级时,份额计算需始终以筛选器选中的Category A和B的总和为基数,即Brand1的份额保持28%。
内容的提问来源于stack exchange,提问作者Antoinette du Toit
相关产品推荐
相关产品推荐

