Forum Discussion

rpinxt's avatar
rpinxt
Icon for Solution Sage rankSolution Sage
3 years ago
Solved

Placeholder issue Calculate formula

I have a measure in which I would to find the quantity for the latest week.

Wanted to do it like this but placeholder error:

 

My MaxWeek :

MaxWeek = WEEKNUM(MAX('Backorder Details'[Doc. Entry]))
 
I also made MaxWeek -1
As you see it works:

 

But now I want the Qty belonging to MaxWeek and Maxweek -1

Because I want to see the change between the last week and the week before.

 

What am I doing wrong? Or is there a better way?

  • Try

    BO Current =
    VAR MaxWeek = [Max week]
    RETURN
        CALCULATE ( [BO Tot Qty], 'Dim date'[Week nr (ISO)] = MaxWeek )
    

    If your data spans multiple years you may also want to filter on the year.

2 Replies

  • Try

    BO Current =
    VAR MaxWeek = [Max week]
    RETURN
        CALCULATE ( [BO Tot Qty], 'Dim date'[Week nr (ISO)] = MaxWeek )
    

    If your data spans multiple years you may also want to filter on the year.

    • rpinxt's avatar
      rpinxt
      Icon for Solution Sage rankSolution Sage

      Superb! johnt75 

      Works like a charm 😄 (also indeed put in a year filter)

       

      So guess you cannot directly reference the measure but putting it in a variable solves this 🙂