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
Xavius
Frequent Visitor

Last week sales issue

Hi all, 

the measure below

Sales last week = CALCULATE( SUM( Table[sales] ), REMOVEFILTERS( table ), table[week] = MAX( table[week] ) - 1 )  

will work but if put Region column it will be repeted   
for example the total will be 10000. 
if put region columns all regions will be equal 10000

 which is wrong 

 Anyone can help me with this ?  
much appreciated. 

1 ACCEPTED SOLUTION
danextian
Super User
Super User

hi @Xavius 

REMOVEFILTERS removes filters from a column or table. So, when you remove filters from a table, it's expected that the measure returns the same value for all rows - regardless of what columns are added to the visual - except for the column directly referenced in the measure. It’s best practice to use a dedicated dates/calendar table so that filter modifiers apply only to that table and don’t unintentionally affect the entire fact table.

Revenue LW = 
CALCULATE (
    [Total Revenue],
    FILTER ( ALL ( Dates ), Dates[Week Num] = MAX ( Dates[Week Num] ) - 1 )
)

danextian_0-1754282577049.png

Please refer to the attached pbix.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

8 REPLIES 8
Anonymous
Not applicable

Hi @Xavius ,

 

We haven’t received an update from you in some time. Could you please let us know if the issue has been resolved?
If you still require support, please let us know, we are happy to assist you.

 

Thank you.

Anonymous
Not applicable

Hi @Xavius ,

 

I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions.

 

Thank you.

Anonymous
Not applicable

Hi @Xavius ,

Thank you for reaching out to the Microsoft fabric community forum.

 

Could you please confirm if the issue has been resolved. I wanted to check if you had the opportunity to review the information provided by @danextian  Also I want to thank you @Royel , @Ashish_Mathur , @FBergamaschi  for your helpful response. Please feel free to contact us if you have any further questions.

 

Thank you.

danextian
Super User
Super User

hi @Xavius 

REMOVEFILTERS removes filters from a column or table. So, when you remove filters from a table, it's expected that the measure returns the same value for all rows - regardless of what columns are added to the visual - except for the column directly referenced in the measure. It’s best practice to use a dedicated dates/calendar table so that filter modifiers apply only to that table and don’t unintentionally affect the entire fact table.

Revenue LW = 
CALCULATE (
    [Total Revenue],
    FILTER ( ALL ( Dates ), Dates[Week Num] = MAX ( Dates[Week Num] ) - 1 )
)

danextian_0-1754282577049.png

Please refer to the attached pbix.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
Royel
Super User
Super User

Hi @Xavius The issue occurs because REMOVEFILTERS( table ) removes ALL filters from the table, including the Region filter, causing every region to show the total sales for the entire dataset.

 

You have to be more careful about removing the filters. Instead of removing all filters from the table, you should only remove the filter from the week/date column while keeping other dimensional filters like Region.

Here is an example:

Sales last week = 
CALCULATE( 
    SUM( Table[sales] ), 
    REMOVEFILTERS( Table[week] ),  -- Only remove week filter
    Table[week] = MAX( Table[week] ) - 1 
)

Is it helped? ✔ Give a Kudo • Mark as Solution – help others too!

 

Xavius
Frequent Visitor

Hi Royel,  

but I want to be able to see all the weeks for example 

 if I put weeks in slicer and choose one week to see the last week sales of it. And wow%. It will show empty 

 I just want to see last week sales, by week, by region in the same time. 
which is difficult for me now  

thanks 

Ashish_Mathur
Super User
Super User

Hi,

Ensure that there is a Calendar table with a week number column.  Once that is in place, share the download link of the PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
FBergamaschi
Super User
Super User

This is likely to happen if the table in which the column Region is included has no relationship with the table Table

 

Can you please show the data model?

 

If this helped, please consider giving kudos and mark as a solution

@me in replies or I'll lose your thread

Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page

Consider voting this Power BI idea

Francesco Bergamaschi

MBA, M.Eng, M.Econ, Professor of BI

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

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.