Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

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:

visual KPI.JPG

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:

Table.JPG

 

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

1 ACCEPTED SOLUTION
AlB
Community Champion
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)

 

View solution in original post

5 REPLIES 5
AlB
Community Champion
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
Not applicable

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

 

But it worked 😄

 

Shows the goal as a WoW percentage

 

visual KPI_correct.JPG

 

Thank you so much for the help.

AlB
Community Champion
Community Champion

@Anonymous

Cool Smiley Happy

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

Cheers

Anonymous
Not applicable

Done 😉

 

Just, for my knowledge.

 

What would be the measure if i had the week without the W?

Would be the same but without the mid function?

 

AlB
Community Champion
Community Champion

@Anonymous

Yes, if you have a number you can just subtract the 1 directly to get the previous week. You don't need all the hassle of converting forth and back between text and number.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors