Forum Discussion

JHJHJH1988's avatar
JHJHJH1988
Frequent Visitor
7 months ago
Solved

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...
  • BeaBF's avatar
    7 months ago

    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!