Forum Discussion
sarath_chandra
Helper III
3 years agoDax help
Hi all, i have week date filter , if i select one date (current week date) and previous week date is prior week date that should be populated in table visual and i need difference of both dynamically...
- 3 years ago
- 3 years ago
Hi,
I am not sure how your datamodel looks like, but I tried to create a sample pbix file like below.
Please check the below picture and the attached pbix file.
Usage prior week: = CALCULATE ( [Usage current week:], OFFSET ( -1, ALL ( 'Calendar'[Year-Wk sort], 'Calendar'[Year-Wk] ) ) )
FreemanZ
Super User
3 years agotry like:
UsageCurrentWeek =
VAR _date = MAX(TableName[week date])
SUMX(
FILTER(TableName, TableName[week date] = _date ),
TableName[usage value]
)
UsagePriorWeek =
VAR _date = MAX(TableName[week date])
SUMX(
FILTER(TableName, WEEKNUM(TableName[week date]) = WEEKNUM(_date) -1 ),
TableName[usage value]
)
difference = UsageCurrentWeek - UsagePriorWeek