Forum Discussion
DAX QUERY SELECTED VALUE
- Anonymous2 years ago
HI JuradoKevin14,
You can create a calculated table to summary two table records and use this to create a table visual.
NewTable = UNION ( SUMMARIZE ( dim_Type, [Carrier], "Total", SUM ( Transactional[Amt] ) ), SUMMARIZE ( dim_Type, [Type], "Total", SUM ( Transactional[Amt] ) ) )Then you can use raw 'dim Type' table 'type' field as source to create a slicer and write a measure formula to receiver filter effect and compare with current table records to return flag.
flag = VAR selectedType = VALUES ( dim_Type[Type] ) VAR reverseCarrier = CALCULATETABLE ( VALUES ( dim_Type[Carrier] ), FILTER ( ALL ( dim_Type ), NOT ( [Type] IN selectedType ) ) ) VAR _current = SELECTEDVALUE ( NewTable[Carrier] ) VAR allCarrier = ALL ( dim_Type[Carrier] ) RETURN IF ( COUNTROWS ( EXCEPT ( ALL ( dim_Type[Type] ), selectedType ) ) = 0, IF ( _current IN allCarrier, "Y", "N" ), IF ( _current IN UNION ( selectedType, reverseCarrier ), "Y", "N" ) )After these steps, you can use the flag measure on table 'visual level filter' to filter records based on slicer selections.
Regards,
Xiaoxin Sheng
HI JuradoKevin14,
You can create a calculated table to summary two table records and use this to create a table visual.
NewTable =
UNION (
SUMMARIZE ( dim_Type, [Carrier], "Total", SUM ( Transactional[Amt] ) ),
SUMMARIZE ( dim_Type, [Type], "Total", SUM ( Transactional[Amt] ) )
)
Then you can use raw 'dim Type' table 'type' field as source to create a slicer and write a measure formula to receiver filter effect and compare with current table records to return flag.
flag =
VAR selectedType =
VALUES ( dim_Type[Type] )
VAR reverseCarrier =
CALCULATETABLE (
VALUES ( dim_Type[Carrier] ),
FILTER ( ALL ( dim_Type ), NOT ( [Type] IN selectedType ) )
)
VAR _current =
SELECTEDVALUE ( NewTable[Carrier] )
VAR allCarrier =
ALL ( dim_Type[Carrier] )
RETURN
IF (
COUNTROWS ( EXCEPT ( ALL ( dim_Type[Type] ), selectedType ) ) = 0,
IF ( _current IN allCarrier, "Y", "N" ),
IF ( _current IN UNION ( selectedType, reverseCarrier ), "Y", "N" )
)
After these steps, you can use the flag measure on table 'visual level filter' to filter records based on slicer selections.
Regards,
Xiaoxin Sheng