Forum Discussion
Dynamic Filtering when using Field Parameters
- 1 year ago
JamesAH , Try using
Create a Parameter Table: Ensure you have a parameter table that allows users to select the two dates dynamically.
Dynamic Column Selection: Use the SELECTEDVALUE function to dynamically reference the columns based on the selected dates.
Change Flag Calculation: Calculate the change flag dynamically without hardcoding the dates.
DAX
ChangeFlag =
VAR SelectedDate1 = SELECTEDVALUE('ParameterTable'[Date1])
VAR SelectedDate2 = SELECTEDVALUE('ParameterTable'[Date2])
VAR SourceStatus = LOOKUPVALUE('InputTable'[Stage], 'InputTable'[ExtractionDate], SelectedDate1)
VAR CurrentStatus = LOOKUPVALUE('InputTable'[Stage], 'InputTable'[ExtractionDate], SelectedDate2)
RETURN
IF(
SourceStatus <> CurrentStatus,
1,
BLANK()
)
JamesAH , Try using
Create a Parameter Table: Ensure you have a parameter table that allows users to select the two dates dynamically.
Dynamic Column Selection: Use the SELECTEDVALUE function to dynamically reference the columns based on the selected dates.
Change Flag Calculation: Calculate the change flag dynamically without hardcoding the dates.
DAX
ChangeFlag =
VAR SelectedDate1 = SELECTEDVALUE('ParameterTable'[Date1])
VAR SelectedDate2 = SELECTEDVALUE('ParameterTable'[Date2])
VAR SourceStatus = LOOKUPVALUE('InputTable'[Stage], 'InputTable'[ExtractionDate], SelectedDate1)
VAR CurrentStatus = LOOKUPVALUE('InputTable'[Stage], 'InputTable'[ExtractionDate], SelectedDate2)
RETURN
IF(
SourceStatus <> CurrentStatus,
1,
BLANK()
)
I just solved this! Worked out that rather than using the pivioted table to to check for change I used the original table and the lookups. So thanks bhanu_gautam as whilst your response wasn't perfect, it gave me the idea.