计算Dax中的出现次数 [英] Count occurrences in Dax

查看:528
本文介绍了计算Dax中的出现次数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有下表:









或者换句话说,如果这是国家名称的第一次出现,则它必须显示 1 2 第二次。

解决方案

尝试使用此方法创建计算结果列发生次数

 出现次数= 
计算(
COUNT([Pais]),
FILTER(
'Table',
[Index]< = EARLIER('Table'[Index])
&& ; [Pais] = EARLIE R('Table'[Pais])


索引必须是每一行的增量键。


I have the following table:

Now, I want to apply some dax instructions to that table, and display this data in a chart:

Or in other words, I if it is the first time that the Country's name appears, it must show 1 and 2 for the second time.

解决方案

Try this for creating a calculated column called Occurrences:

Occurrences =
CALCULATE (
    COUNT ( [Pais] ),
    FILTER (
        'Table',
        [Index] <= EARLIER ( 'Table'[Index] )
            && [Pais] = EARLIER ( 'Table'[Pais] )
    )
)

Index must be an incremental key in each row.

这篇关于计算Dax中的出现次数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆