Forum Discussion
Nethunt
8 years agoFrequent Visitor
Report data from same week previous year
Appended dataqueries from several companies to a new query in Power BI. Every company query has almost the same columns (YearWeek, SalesTotal, SalesA, SalesB, SalesC, ........). Before appending i ...
Nethunt
8 years agoFrequent Visitor
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
Anonymous
8 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