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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Jpahl2033
Helper I
Helper I

Weekly Sales & Previous Week Sales Measure Not Filtering in Table

Hi,

 

I have two measures going for Sales this week & Sales previous week. When i try to a slicer or use a filter for these items they do not change. They are the aggregate values still.  Can someone please help? I want to be able to use a slicer/filter to pull different text values i.e. Client A, Client B. The measures are below:

 

Thanks!

 

Sales This Week = CALCULATE(SUM('Table1'[OrderedProductSales]),FILTER(ALL('Table1'),'Table1'[WeekRank] =MAX('Table1'[WeekRank])))
 
Sales Last Week = CALCULATE(SUM('Table1'[OrderedProductSales]),FILTER(ALL('Table1'),'Table1'[WeekRank] =MAX('Table1'[WeekRank])-1))
 
 
1 ACCEPTED SOLUTION
SpartaBI
Community Champion
Community Champion

@Jpahl2033 try first to replace the ALL('Table1') with ALL('Table1'[WeekRank])
Also use variables, but in this case that wasn't the issue, so write this: 


Sales This Week = 
VAR _current_week = MAX('Table1'[WeekRank])
RETURN
CALCULATE(SUM('Table1'[OrderedProductSales]),FILTER(ALL('Table1'[WeekRank]'),'Table1'[WeekRank] =_current_week))
 
Sales Last Week = 
VAR _current_week = MAX('Table1'[WeekRank])
RETURN
CALCULATE
(SUM('Table1'[OrderedProductSales]),FILTER(ALL(Table1'[WeekRank]),'Table1'[WeekRank] = _current_week  -1 ))


In case it answered your question please mark this as a solution for community visibility. Appreciate Your Kudos 🙂

View solution in original post

4 REPLIES 4
Jpahl2033
Helper I
Helper I

I actually figured it out, but switching out a column name. Thank you so much for your help. I will mark it as completed. 

SpartaBI
Community Champion
Community Champion

@Jpahl2033 try first to replace the ALL('Table1') with ALL('Table1'[WeekRank])
Also use variables, but in this case that wasn't the issue, so write this: 


Sales This Week = 
VAR _current_week = MAX('Table1'[WeekRank])
RETURN
CALCULATE(SUM('Table1'[OrderedProductSales]),FILTER(ALL('Table1'[WeekRank]'),'Table1'[WeekRank] =_current_week))
 
Sales Last Week = 
VAR _current_week = MAX('Table1'[WeekRank])
RETURN
CALCULATE
(SUM('Table1'[OrderedProductSales]),FILTER(ALL(Table1'[WeekRank]),'Table1'[WeekRank] = _current_week  -1 ))


In case it answered your question please mark this as a solution for community visibility. Appreciate Your Kudos 🙂

Thank you for this! It is very close. When I plug in the two new measures you created, the Sales Last Week Numbers do not show up in the table, but the Sales This week numbers do. Have any ideas?

@Jpahl2033 do you use a sort by column in the model for the one you put on the axis?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.