Forum Discussion
Jay_AVA
3 years agoFrequent Visitor
Apply Filter Based On Selected Values
Hi everyone, I have 2 tables: Product Name Home Location A 02-1 B 03-1 Location Location ID Status Line Number Level 01-1 Empty ...
- 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
Jay_AVA
3 years agoFrequent Visitor
Hi PaulDBrown
PaulDBrown wrote:Is it if the difference between the selected "line" and other lines <= 1?
Yes, exactly.
Anonymous
3 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"