Forum Discussion
QTR TARGET, PRESENT WEEK, LAST WEEK
To create a dynamic target measure for last week, you can use the following DAX formula:
Last Week Target = IF(MAX('Table'[Week])=MAX('Table'[Current Week]), [Current Quarter Target], CALCULATE(MAX('Table'[Target]), FILTER('Table', 'Table'[Week] = MAX('Table'[Last Week]))))
In this formula, we first check if the maximum value of the 'Week' column is the same as the maximum value of the 'Current Week' column. If it is, then we use the 'Current Quarter Target' measure. If not, we use the 'CALCULATE' function to retrieve the maximum value of the 'Target' column for the last week.
To show values till the previous quarter for the last week, you can modify the formula to use the 'IF' function again to check if the last week is in the previous quarter. If it is, then you can retrieve the target values for the previous quarter using a separate measure.
I hope this helps!