cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jaco1951 Member
Member

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

Accepted Solutions
jaco1951 Member
Member

Re: Get values from previous week of selected week

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"))
2 REPLIES 2
rocky09 Senior Member
Senior Member

Re: Get values from previous week of selected week

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])
)
jaco1951 Member
Member

Re: Get values from previous week of selected week

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
Back to School Contest

Back to School Contest

Engage and empower students with Power BI!

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Summit Australia 2019

Summit Australia 2019

Travel to Melbourne and network with thousands of peers!

Top Ideas
Users Online
Currently online: 357 members 3,597 guests
Please welcome our newest community members: