Forum Discussion
Last week sales issue
- 1 year ago
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 ) )Please refer to the attached pbix.
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!
- Xavius1 year agoFrequent 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 nowthanks