Forum Discussion
Calculating Previous Values
- Anonymous4 years ago
Would something like this serve? I am assuming that the source data has a [Fiscal Week Ends] column, not a hire date.
Last 2 Weeks New =
var currentweek = [Fiscal Week Num]var previousweek = [Fiscal Week Num]-1
var currentweekhires =
CALCULATE(
SUM(
'Terms & Hires SQL'[Net Hires]),
[Fiscal Week End]=currentweekvar previousweekhires =
CALCULATE(
SUM(
'Terms & Hires SQL'[Net Hires]),
[Fiscal Week End]=previousweekreturn
currentweekhires+previousweekhires
this is giving me the same value as net hires....
Sorry mate, just change VAR _1 to the following:
VAR _1 = LASTDATE ( 'Table'[Date] ) - 7
So the whole measure will be:
14 Days =
VAR _1 = LASTDATE ( 'Table'[Date] ) - 7 // This is the date in your fact table
VAR _2 = _1 - 14 // represents the 14 days in the respective fortnight
RETURN
CALCULATE ( SUM ('Table'[Amount] ) , FILTER ( ALL ( 'Date') , AND ( 'Date'[Date] > _2 , 'Date'[Date] <= _1 ) ) )
- Anonymous4 years agoNot applicable
Now it's blank...I am trying to tinker with it myself too by the way....
- TheoC4 years agoCommunity Champion
Anonymous try the below:
14 Days =
VAR_1 = LASTDATE ( 'Terms & Hires SQL'[Fiscal Week Ends] ) - 7
VAR_2 = _1 - 14
RETURN
CALCULATE ( SUM ('Terms & Hires SQL'[Net Hires] ) , FILTER ( ALL ( 'Terms & Hires SQL'[Fiscal Week Ends]) , AND ( 'Terms & Hires SQL'[Fiscal Week Ends] > _2 , 'Terms & Hires SQL'[Fiscal Week Ends] <= _1 ) ) )- Anonymous4 years agoNot applicable
It was giving me errors so I modified it (bottom snip)