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
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
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.