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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
jaco1951
Helper III
Helper III

Get values from previous week of selected week

Hi

 

I am not able to get the sum of amount from previous week. It seems like the second filter in my expression is causing the trouble...

cash_lastWeek = 
CALCULATE(
	SUM(
factTable[amount]
); FILTER( ALL(calendar); calendar[YearWeek] = MAX(calendar[YearWeek]) - 1); FILTER( factTable;factTable[dataSource] = "CashReport")
)

 

Removing the filter for "CashReport" the values seems to follow changes in "YearWeek" field.

Br Espen

 

1 ACCEPTED SOLUTION

I figured out somthing that does work, it might not be the most delicate solution.

 

Here's what I did:

 

prev_Cash = CALCULATE(
SUM(factTable[amount]);
FILTER(ALL(calendar); calendar[YearWeek] = MAX(calendar[YearWeek]) - 1);
FILTER(ALL(factTable[dataSource]);factTable[dataSource] = "CashReport"))

View solution in original post

2 REPLIES 2
rocky09
Solution Sage
Solution Sage

something like this?

 

pre_sales = var enddate = MIN(Table2[Date])-1
var startdate = enddate - 6
return
CALCULATE(SUM(Table2[Amt]),DATESBETWEEN(Table2[Date],startdate,enddate),ALLSELECTED(Table2[WeekNumber])
)

I figured out somthing that does work, it might not be the most delicate solution.

 

Here's what I did:

 

prev_Cash = CALCULATE(
SUM(factTable[amount]);
FILTER(ALL(calendar); calendar[YearWeek] = MAX(calendar[YearWeek]) - 1);
FILTER(ALL(factTable[dataSource]);factTable[dataSource] = "CashReport"))

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors