Forum Discussion
Apply Filter Based On Selected Values
- Anonymous3 years ago
Hi Jay_AVA ,
You can follow the steps below to get it, please find the details in the attachment.
1. Create a measure as below:
Flag = VAR _sellid = SELECTEDVALUE ( 'Location'[Location ID] ) VAR _selname = SELECTEDVALUE ( 'Product'[Name] ) VAR _hlocation = CALCULATE ( MAX ( 'Product'[Home Location] ), FILTER ( ALLSELECTED ( 'Product' ), 'Product'[Name] = _selname ) ) VAR _linenum = CALCULATE ( MAX ( 'Location'[Line Number] ), FILTER ( ALLSELECTED ( 'Location' ), 'Location'[Location ID] = _hlocation ) ) VAR _tab = CALCULATETABLE ( VALUES ( 'Location'[Location ID] ), FILTER ( ALLSELECTED ( 'Location' ), 'Location'[Line Number] <= _linenum + 1 && 'Location'[Status] = "Empty" ) ) RETURN IF ( _sellid IN _tab, 1, 0 )2. Create a table visual and apply the visual-level filter with the condition(Flag is 1)
Best Regards
How do you define "close"? Is it if the difference between the selected "line" and other lines <= 1?
Hi PaulDBrown
PaulDBrown wrote:Is it if the difference between the selected "line" and other lines <= 1?
Yes, exactly.
- Anonymous3 years agoNot applicable
Hi Jay_AVA ,
You can follow the steps below to get it, please find the details in the attachment.
1. Create a measure as below:
Flag = VAR _sellid = SELECTEDVALUE ( 'Location'[Location ID] ) VAR _selname = SELECTEDVALUE ( 'Product'[Name] ) VAR _hlocation = CALCULATE ( MAX ( 'Product'[Home Location] ), FILTER ( ALLSELECTED ( 'Product' ), 'Product'[Name] = _selname ) ) VAR _linenum = CALCULATE ( MAX ( 'Location'[Line Number] ), FILTER ( ALLSELECTED ( 'Location' ), 'Location'[Location ID] = _hlocation ) ) VAR _tab = CALCULATETABLE ( VALUES ( 'Location'[Location ID] ), FILTER ( ALLSELECTED ( 'Location' ), 'Location'[Line Number] <= _linenum + 1 && 'Location'[Status] = "Empty" ) ) RETURN IF ( _sellid IN _tab, 1, 0 )2. Create a table visual and apply the visual-level filter with the condition(Flag is 1)
Best Regards
- Jay_AVA3 years agoFrequent Visitor
Thanks Anonymous
It works!! Appreciate your help!!
I just added one more condition to the last filter since I only need the closest location.
FILTER (ALLSELECTED ( 'Location' ),'Location'[Line Number] <= _linenum + 1&& 'Location'[Line Number] >= _linenum - 1&& 'Location'[Status] = "Empty"