英文:
incorrect ranking power bi-dax
问题
我有一个包含以下数据的数组:
组别 材料 值
1 a1 10
a2 23
a3 1
..
an 32
2 b1 10
b2 2
b3 23
..
bn 1
我想要得到一个排名,但不是像这样给我值:
1
2
3
..
10
而是得到以下结果:
组别 材料 值 排名
1 a1 10 12
a2 23 23
a3 1 40
..
an 32 3
2 b1 10 11
b2 2 39
b3 23 24
..
bn 1 42
这是我的公式:
RANKX( FILTER( 'table','table'[group] = EARLIER('table'[group])),'table'[value], , DESC)
我还有其他要筛选的字段,比如center和date,但它们不在矩阵显示中。有没有办法修改我的排名?谢谢。
英文:
I HAVE AN ARRAY WITH THE FOLLOWING DATA
group mat value
1 a1 10
a2 23
a3 1
..
an 32
2 b1 10
b2 2
b3 23
..
bn 1
i want to get a rank but instead of giving me values like
1
2
3
..
10
i get the following
group mat value rank
1 a1 10 12
a2 23 23
a3 1 40
..
an 32 3
2 b1 10 11
b2 2 39
b3 23 24
..
bn 1 42
this is my formula:
RANKX( FILTER( 'table','table'[group] = EARLIER('tabla'[group])),'tabla'[value], , DESC)
and I have other fields to filter such as center and date but they are not in the matrix display
any idea how to change my ranking? Tanks
答案1
得分: 0
首先,使用“Transform Data”功能,填充“Group”列的数值。
然后编写一个度量值:
Measure = SUM(Data[value])
接下来编写一个排名度量值:
Rank = RANKX(ALLEXCEPT(Data, Data[group]), [Measure])
如果你想要在中心和日期上进行筛选,请将这些列添加到ALLEXCEPT筛选条件中:
Rank = RANKX(ALLEXCEPT(Data, Data[group], Data[center], Data[Date]), [Measure])
英文:
First using Transform Data, Fill down values for Group column
Then write a measure
Measure = SUM(Data[value])
Then write a Rank measure
Rank = RANKX(ALLEXCEPT(Data, Data[group]), [Measure])
If you want filter on center and date then give those columns in ALLEXCEPT filter
Rank = RANKX(ALLEXCEPT(Data, Data[group], Data[center], Data[Date]), [Measure])
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论