percentage difference with month and year and count in table using DAX

。_饼干妹妹 提交于 2019-12-04 17:28:29

In your current setup, something like this could work. Using a datetable would be better and easier though.

%change = 
VAR StartLastMonth =
    ( DATE ( 'table'[Year], 'table'[Month] - 1, 1 ) )
VAR RecordsLastMonth =
    CALCULATE (
        MAX ( 'table'[Records] ),
        FILTER (
            'table',
            'table'[Year] = YEAR ( StartLastMonth )
                && 'table'[Month] = MONTH ( StartLastMonth )
        )
    )
RETURN
    IF (
        ISBLANK ( RecordsLastMonth ),
        BLANK (),
        'table'[Records] - RecordsLastMonth
    )
        / RecordsLastMonth

How about using below code:

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