Forum Discussion
Unlinked Calendar and DAX
Hello
I am working on a HR PowerBImodel and as I am dealing with several date columns, a decision was taken to have an unlinked calendar table and have DAX account for any date selections via the date slicer. The unlinked Calendar is called dimdateselection and there are a series of column values under this table, the main one being [Date] and then we have other columns that state what period this date value is against our financial calendar eg all date from 01/12/2025 to 28/12/2025 is P8 for us.
I'm first of all calculating daily headcount via the below measure which i can confirm is working correctly in terms of daily output:
i then have the below measure that is calculating the % difference in average headcount rolling 12:
JHJHJH1988 Hi!
Can you share the pbix to fix directly the measure on your data?
Try to fix the measure as:
Average Headcount Rolling 12 % change (Live) =
VAR CurrentOffset =
MAX ( dimdateselection[FiscalPeriodOffSet] )VAR WinCurr =
FILTER (
ALL ( dimdateselection ),
dimdateselection[FiscalPeriodOffSet] >= CurrentOffset - 11
&& dimdateselection[FiscalPeriodOffSet] <= CurrentOffset
)VAR CurrRolling =
AVERAGEX ( WinCurr, [Headcount between Dates (Live)] )VAR WinPrior =
FILTER (
ALL ( dimdateselection ),
dimdateselection[FiscalPeriodOffSet] >= CurrentOffset - 22
&& dimdateselection[FiscalPeriodOffSet] <= CurrentOffset - 11
)VAR PriorRolling =
AVERAGEX ( WinPrior, [Headcount between Dates (Live)] )RETURN
IF (
OR ( ISBLANK ( CurrRolling ), ISBLANK ( PriorRolling ) ),
BLANK (),
DIVIDE ( CurrRolling - PriorRolling, PriorRolling )
)BBF
💡 Did I answer your question? Mark my post as a solution!
👍 Kudos are appreciated
🔥 Proud to be a Super User!
2 Replies
- JHJHJH1988Frequent Visitor
- BeaBF
Super User
JHJHJH1988 Hi!
Can you share the pbix to fix directly the measure on your data?
Try to fix the measure as:
Average Headcount Rolling 12 % change (Live) =
VAR CurrentOffset =
MAX ( dimdateselection[FiscalPeriodOffSet] )VAR WinCurr =
FILTER (
ALL ( dimdateselection ),
dimdateselection[FiscalPeriodOffSet] >= CurrentOffset - 11
&& dimdateselection[FiscalPeriodOffSet] <= CurrentOffset
)VAR CurrRolling =
AVERAGEX ( WinCurr, [Headcount between Dates (Live)] )VAR WinPrior =
FILTER (
ALL ( dimdateselection ),
dimdateselection[FiscalPeriodOffSet] >= CurrentOffset - 22
&& dimdateselection[FiscalPeriodOffSet] <= CurrentOffset - 11
)VAR PriorRolling =
AVERAGEX ( WinPrior, [Headcount between Dates (Live)] )RETURN
IF (
OR ( ISBLANK ( CurrRolling ), ISBLANK ( PriorRolling ) ),
BLANK (),
DIVIDE ( CurrRolling - PriorRolling, PriorRolling )
)BBF
💡 Did I answer your question? Mark my post as a solution!
👍 Kudos are appreciated
🔥 Proud to be a Super User!