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
- 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