Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hello everyone,
i have a slicer that seelcts week number
i have a line chart , x-axis is date and y-axis is total sales
i created a measure to calculate last week sales called Previous week sales
today is Friday 28 april 2023 which is week 18
week 18 starts from monday 24 2023 and ends sunday 30 2023
week 17 starts monday 17 2023 and ends sunday 23 2023
if i selected week 18 on my slicer
i want the line chart to return dates from monday 17 to max date which is sunday 23
how can i achieve this?
@tamerj1 @johnt75 @FreemanZ @amitchandak
Solved! Go to Solution.
i found a slution , create a new calander table completely separt no relationships
create a measure
Filtering =
VAR selectedweek = MAX(Calander[Week ID])
VAR lastweek = selectedweek - 1
VAR weekstart = CALCULATE(MIN(Calander[Date]),REMOVEFILTERS(Calander[Date]),Calander[Week ID] = lastweek)
VAR weekend = MAX(Calander[Date])
VAR result = IF(AND(MIN('Calander Inactive'[Date]) >= weekstart, MAX('Calander Inactive'[Date]) <= weekend), 1, 0)
RETURN
result
add the date from seperate calendar table to line chart on x-axis
create a new measure
Line Chart Sales = CALCULATE([Sales],REMOVEFILTERS(Calander[Date]),Calander[Date] = MAX('Calander Inactive'[Date]))
i found a slution , create a new calander table completely separt no relationships
create a measure
Filtering =
VAR selectedweek = MAX(Calander[Week ID])
VAR lastweek = selectedweek - 1
VAR weekstart = CALCULATE(MIN(Calander[Date]),REMOVEFILTERS(Calander[Date]),Calander[Week ID] = lastweek)
VAR weekend = MAX(Calander[Date])
VAR result = IF(AND(MIN('Calander Inactive'[Date]) >= weekstart, MAX('Calander Inactive'[Date]) <= weekend), 1, 0)
RETURN
result
add the date from seperate calendar table to line chart on x-axis
create a new measure
Line Chart Sales = CALCULATE([Sales],REMOVEFILTERS(Calander[Date]),Calander[Date] = MAX('Calander Inactive'[Date]))
User | Count |
---|---|
16 | |
13 | |
12 | |
11 | |
11 |
User | Count |
---|---|
19 | |
15 | |
14 | |
11 | |
10 |