admin管理员组文章数量:1414908
I need help with creating a working dax formula in Power Bi desktop.
I am trying to calculate percentage change year over year but using fiscal week numbers as we have a retail 4-4-5 custom calendar that has different periods for months across different years. For instance, Jan 2025, cut off on Jan 25th and Jan 26th is considered a period in February, the formula below was working fine with a regular calendar year until we introduced this new custom 4-4-5 calendar, I do have fiscal week numbers, fiscal month number and fiscal year. Fiscal year starts normally from Jan-Dec. Here is the dax below that I tried and works only well with a regular gregorian calendat year.
YOY% =
IF(
ISFILTERED(Date_Dimension[Full_Date].[Date]),
ERROR("Time intelligence quick measures can only be grouped or filtered by the Power BI-provided date hierarchy or primary date column."),
VAR __PREV_YEAR =
CALCULATE(
SUM('Sales'[Total Sales]),
DATEADD('Date_Dimension'[Full_Date], -1, YEAR)
)
RETURN
DIVIDE(SUM('Sales'[Total Sales]) - __PREV_YEAR,__PREV_YEAR)
)
Right now, what is happening is the change in percentage is comparing the days for Jan 2025 the same exact days in Jan 2024 which is not correct as Jan 2025 cuts off on Jan 25 and Jan 2024 cuts on on Jan 27.
I have tried changing the date parameters using all and datebetween and still same result, its always comparing the same days in a month among different years.
Right now, what is happening is the change in percentage is comparing the days for Jan 2025 the same exact days in Jan 2024 which is not correct as Jan 2025 cuts off on Jan 25 and Jan 2024 cuts on on Jan 27.
I have tried changing the date parameters using all and datebetween and still same result, its always comparing the same days in a month among different years.
本文标签: mathChange incalculation from previous year using custom fiscal week numbersStack Overflow
版权声明:本文标题:math - Change in % calculation from previous year using custom fiscal week numbers - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745171258a2645988.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论