you can create a new table and sort the category column by sort column
do not create relationship between two tables
then create a measure
MEASURE =
SWITCH (
TRUE (),
SELECTEDVALUE ( 'Table (2)'[category] ) = "A", CALCULATE ( SUM ( 'Table'[value] ), 'Table'[category] = "A" ),
SELECTEDVALUE ( 'Table (2)'[category] ) = "B", CALCULATE ( SUM ( 'Table'[value] ), 'Table'[category] = "B" ),
CALCULATE ( SUM ( 'Table'[value] ) )
)