Forum Discussion

irenelitw629's avatar
irenelitw629
Icon for Helper II rankHelper II
6 years ago

Last week amount DAX doesn't work

Hi,

 

Can someone take a look why my Last week sales amount DAX doesn't work?  Here is the file

 

What i did first is to create a Weeknum based on raw data

Weeknum = SUBSTITUTE(data[WeekInYear_CC],"2020-WK","")

 

Then I create a Last week DAX within same table

Last week =
VAR week = SELECTEDVALUE(data[Weeknum])
Return
CALCULATE(SUM(data[Amount]),
ALL(data),
data[Weeknum]= week -1
)
 
This DAX doesn't work - I tried to create a calendar table but then my main data source is direct query so i can't create a relationshop. I learnt how to do it previously but now it is not working again....Thanks for advice!

4 Replies