我有两个数据表:
1。事实:
ImaginaryFact =
DATATABLE (
"FruitKey", INTEGER,
"Amount", INTEGER,
{
{ 1, 1 },
{ 1, 5 },
{ 1, 2 },
{ 2, 2 },
{ 2, 3 },
{ 3, 4 },
{ 3, 5 },
{ 4, 2 },
{ 5, 2 },
{ 6, 3 },
{ 7, 8 }
} )
2.Dimension:
Dimension =
DATATABLE (
"FruitKey", INTEGER,
"Fruit", STRING,
"Colour", STRING,
{
{ 1, "Apple", "Green" },
{ 6, "Apple", "Blue" },
{ 7, "Apple", "Red" },
{ 2, "Pear", "Pink" },
{ 3, "Orange", "Green" },
{ 4, "Kiwi", "Green" },
{ 5, "Mango", "Green" }
} )
通过这种简单的连接:
然后我创建了这两个度量:
Amount = SUM( ImaginaryFact[Amount] )
Rank Fruity =
IF(
ISFILTERED( 'Dimension'[Colour] ),
RANKX( ALLSELECTED( 'Dimension'[Colour] ), [Amount] ),
IF(
ISFILTERED( 'Dimension'[Fruit] ),
RANKX( ALLSELECTED( 'Dimension'[Fruit] ), [Amount] )
)
)
如果我创建一个“矩阵”,则度量“水果味排名”意味着我可以在“水果”和“颜色”之间上下移动,并且该排名仍然有效,并且由于不需要过滤该行,该行将被清空:
问题在这里 当我向下钻取层次结构时,我想返回小计的空白,与总计总数行为空白...
答案 0 :(得分:0)
请尝试使用IF(IsFiltered(),,)函数代替If(HasOneValue(),)
https://powerpivotpro.com/2013/03/isfiltered-a-better-way-to-detect-totals/