Forum Discussion
Report data from same week previous year
Hi Nethunt,
I think you need to create a table as the source of slicer, then use the slicer value as the condition to use in formula: (the value 'year' are from the slicer)
LAST YEAR sales total =
VAR current_company =
LASTNONBLANK ( 'GROUP'[Company], [Company] )
RETURN
CALCULATE (
SUM ( 'GROUP'[salestotal] ),
FILTER (
ALLSELECTED ( 'GROUP' ),
'GROUP'[Year]
= SELECTEDVALUE('Table'[Year])
&&'GROUP'[Week]= MAX('GROUP'[Week])
&& 'GROUP'[Company] = current_company
)
)
Regards,
Xiaoxin Sheng
Thanks Xiaoxin Sheng, again a little step closer.
As mentioned before, when these were salesdata from the year 2017, the line should give the totals of 2016. Now column and line are from the same year.
Greetings
- Anonymous8 years agoNot applicable
Hi Nethunt,
I think you can add '-1' to filter on pervious year.
LAST YEAR sales total = VAR current_company = LASTNONBLANK ( 'GROUP'[Company], [Company] ) RETURN CALCULATE ( SUM ( 'GROUP'[salestotal] ), FILTER ( ALL( 'GROUP' ), 'GROUP'[Year] = SELECTEDVALUE('Table'[Year])-1 &&'GROUP'[Week]= MAX('GROUP'[Week]) && 'GROUP'[Company] = current_company ) )Regards,
Xiaoxin Sheng
- Nethunt8 years agoFrequent Visitor
Hello Anonymous,
Thanks for your reaction.
I tried that already. After that the line disappears.
So probably something with text / value indentification ?
In both tables 'GROUP' and 'YEAR', the datatype for [YEAR] is set on whole number.
I even tried to add a column [YEAR-1] in the 'YEAR' table and picked thisone as a selectedvalue; in that case the line isn't also visable.
- Anonymous8 years agoNot applicable