Forum Discussion
Report data from same week previous year
HI Nethunt,
You can add a condition to check current company:
LASTYEARsalestotal =
VAR current_company =
LASTNONBLANK ( 'GROUP'[Company], [Company] )
RETURN
CALCULATE (
SUM ( 'GROUP'[salestotal] );
FILTER (
ALLSELECTED ( 'GROUP' );
VALUE ( 'GROUP'[Year] )
= YEAR ( TODAY () ) - 1
&& VALUE ( 'GROUP'[Week] ) = WEEKNUM ( TODAY () )
&& 'GROUP'[Company] = current_company
)
)
Regards,
Xiaoxin Sheng
Thanks Xiaoxin Sheng
Seems like a good begin, but not the final result I need.
In each week of the chart, we want to see in the line the weektotals of last year's week.
So in week 201701 we have stacked data from sales A, B and C (together SalesTotal); in the line should be the SalesTotal form last year 201601). Stacked 201702 together with line 201602 etc.
Chart 2016Our last data is by e.g. week 201739 - this measurement gives only the lastyear data for 201639 as a constant and is only visible when in the chart the year 2016 is selected.
For choosing the year and the company (or several company's) i used a slicer.
When changing the year or the company('s) the line should change to the data from the previous year (in this example chart - all the weeks from 2015).
Don't know if this can be done with a measure. Adding columns (with data last year for each YearWeekCompany) gives a double as much data in the query and seems not the most logical solution.
- Ashish_Mathur8 years agoSuper User
Hi,
Can you share a sample dataset and show the expected result.
- Nethunt8 years agoFrequent Visitor
Thanks for replying.
For the expected result see chart in reply from today.
Simplified the GROUP query is as follows
- Ashish_Mathur8 years agoSuper User
Hi,
Share the data in an Excel or .pbix file.