Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

KPI Visual - Last week comparison

Hello, im very new to power bi, and so im, still, a little lost week dax.

 

I want to make a visual that compares the last week, something like this:

which the goal should be the value of last week.

 

 

I tried to made a measure like this:

Realizadas Last Week = CALCULATE(sum(ft_dados_base[realizadas]);filter(ft_dados_base;ft_dados_base[semana_ref]="Semana W-1"))

 

But shows me like this:

 

the original idea would be to show,  in the column "Realizadas LastW" in the W51, the value of the W50, so in the KPI visual the goal would be of the W50.

 

I tried to search for an answer but couldnt find one.

 

what can i do to made this work?

 

thank you

  • Hi Anonymous

     

    It would probably be easier to have just the week numbers instead of the 'W' plus the number. If you have the weeks in the rows of the matrix as you show, you can use a measure like:

     

     

    Measure=
    VAR  _CurrentWeek = SELECTEDVALUE(Table1[Week])
    VAR _PreviousWeek=  "W" & VALUE(MID(_CurrentWeek, 2, LEN(_CurrentWeek)-1))-1
    RETURN
    CALCULATE(SUM(Table1[realizadas]), Table1[Week]=_PreviousWeek)

     

5 Replies

  • AlB's avatar
    AlB
    Community Champion

    Hi Anonymous

     

    It would probably be easier to have just the week numbers instead of the 'W' plus the number. If you have the weeks in the rows of the matrix as you show, you can use a measure like:

     

     

    Measure=
    VAR  _CurrentWeek = SELECTEDVALUE(Table1[Week])
    VAR _PreviousWeek=  "W" & VALUE(MID(_CurrentWeek, 2, LEN(_CurrentWeek)-1))-1
    RETURN
    CALCULATE(SUM(Table1[realizadas]), Table1[Week]=_PreviousWeek)

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hello AlB i have a column with the yearweek too, the W51 is represented with 201851.

       

      But it worked :D

       

      Shows the goal as a WoW percentage

       

       

      Thank you so much for the help.

      • AlB's avatar
        AlB
        Community Champion

        Anonymous

        Cool :smileyhappy:

        If it's what you were looking for, please accept the answer as solution so that it's visible for others as well.

        Cheers