Count occurrences in Dax

只愿长相守 提交于 2019-12-11 06:25:50

问题


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.


回答1:


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.

Let me know if this helps.



来源:https://stackoverflow.com/questions/42447290/count-occurrences-in-dax

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!