Forum Discussion
Week vs prior week in visual based on slicer selection
- 1 year ago
buttercream , You can not accomplish a trend based on that,
You can have measures
Last week =
var _max = maxx(ALLSELECTED('Date'[Date]),'Date'[Date] ) -1
Var _min = Max -6
return
calculate([measure], filter(all('Date'), 'Date'[Date] >= _min && 'Date'[Date] <= _max))Next Week=
var _max = maxx(ALLSELECTED('Date'[Date]),'Date'[Date] ) +7
Var _min = Max +1
return
calculate([measure], filter(all('Date'), 'Date'[Date] >= _min && 'Date'[Date] <= _max))same way you can calculate dates to display on labels
- 1 year ago
Hi,
Try this approach
- Create a Calendar table
- Create a relationship (Many to One and Single) from the Date column of your fact table to the Date column of the Calendar table
- To your visual/table/slicer/filter, drag date from the Calendar table and select a date there
- Write these measure
Total = sum(Data[Amount])
Total in this week = calculate([total],datesbetween(calendar[date],min(calendar[date])-6,min(calendar[date])))
Total in previous week = calculate([Total in this week],
datesbetween(calendar[date],min(calendar[date])-6,min(calendar[date])))
Hope this helps.
Hi,
Try this approach
- Create a Calendar table
- Create a relationship (Many to One and Single) from the Date column of your fact table to the Date column of the Calendar table
- To your visual/table/slicer/filter, drag date from the Calendar table and select a date there
- Write these measure
Total = sum(Data[Amount])
Total in this week = calculate([total],datesbetween(calendar[date],min(calendar[date])-6,min(calendar[date])))
Total in previous week = calculate([Total in this week],
datesbetween(calendar[date],min(calendar[date])-6,min(calendar[date])))
Hope this helps.