Forum Discussion
Measure to switch between table columns on visual: returns entire column rows
- Anonymous4 years ago
Hi smore,
I'd like to suggest you extract and merge the 'no' and 'dog' fields to create a new table with unique value as the bridge link to those tables.
How to Join Many to Many with a Bridge Table in Power BI | Seer Interactive
Relationship in Power BI with Multiple Columns - RADACAD
After these steps, you can create a parameter table with two table names as the source of the slicer, then you can write a measure filter to redirect to different calculation formulas based on selections.
Weight Measure = VAR currDogNO = SELECTEDVALUE ( Bridge[DogNO] ) //DogNo are merge from 'Group NO' and 'Dog' field values VAR Selection = SELECTEDVALUE ( 'Selector'[Source] )//Selecotr with two table Names RETURN SWITCH ( Selection, "Mechanical", CALCULATE ( SUM ( Mechanical[Weight] ), FILTER ( ALLSELECTED ( Mechanical ), Mechanical[DogNO] = currDogNO ) ), "Digital", CALCULATE ( SUM ( Digital[Weight] ), FILTER ( ALLSELECTED ( Digital ), Digital[DogNO] = currDogNO ) ) )Regards,
Xiaoxin Sheng
Hi smore,
I'd like to suggest you extract and merge the 'no' and 'dog' fields to create a new table with unique value as the bridge link to those tables.
How to Join Many to Many with a Bridge Table in Power BI | Seer Interactive
Relationship in Power BI with Multiple Columns - RADACAD
After these steps, you can create a parameter table with two table names as the source of the slicer, then you can write a measure filter to redirect to different calculation formulas based on selections.
Weight Measure =
VAR currDogNO =
SELECTEDVALUE ( Bridge[DogNO] ) //DogNo are merge from 'Group NO' and 'Dog' field values
VAR Selection =
SELECTEDVALUE ( 'Selector'[Source] )//Selecotr with two table Names
RETURN
SWITCH (
Selection,
"Mechanical",
CALCULATE (
SUM ( Mechanical[Weight] ),
FILTER ( ALLSELECTED ( Mechanical ), Mechanical[DogNO] = currDogNO )
),
"Digital",
CALCULATE (
SUM ( Digital[Weight] ),
FILTER ( ALLSELECTED ( Digital ), Digital[DogNO] = currDogNO )
)
)
Regards,
Xiaoxin Sheng