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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
lbama7k
Frequent Visitor

visual KPI week previous week

Hello, I need your help.

 

I need have a visual KPI with sales ( "ventas" in my file) of the last week and the gol is sales of previus week. I can't do this.

I try to calculate "previous week= semana -1", but it isn't work.

 

My file is the following..

Thanks!

 

Captura.PNG

1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hi, @lbama7k 

You may refer to this post I have solved:

https://community.powerbi.com/t5/Desktop/KPI-card-displays-different-value-to-card-and-table-any-way...

And for your case, add a rank column by YearWeek.

Rank = RANKX(Table1,Table1[YearWeek],,ASC)

Then use this measure for kpi visual

Measure = CALCULATE(SUM(Table1[Ventas]),FILTER(ALLSELECTED(Table1),Table1[Rank]=MAX(Table1[Rank])-1))

Result:

6.JPG

 

and here is pbix file, please try it.

 

Best Regards,

Lin

 

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
lbama7k
Frequent Visitor

Hello, I need your help.

 

I need have a visual KPI with sales ( "ventas" in my file) of the last week and the gol is sales of previus week. I can't do this.

I try to calculate "previous week= semana -1", but it isn't work.

 

My file is the following..

Thanks!

 

Captura.PNG

v-lili6-msft
Community Support
Community Support

hi, @lbama7k 

You may refer to this post I have solved:

https://community.powerbi.com/t5/Desktop/KPI-card-displays-different-value-to-card-and-table-any-way...

And for your case, add a rank column by YearWeek.

Rank = RANKX(Table1,Table1[YearWeek],,ASC)

Then use this measure for kpi visual

Measure = CALCULATE(SUM(Table1[Ventas]),FILTER(ALLSELECTED(Table1),Table1[Rank]=MAX(Table1[Rank])-1))

Result:

6.JPG

 

and here is pbix file, please try it.

 

Best Regards,

Lin

 

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hello! It works. Thanks!!

Helpful resources

Announcements
Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.