Forum Discussion
Anonymous
4 years agoNot applicable
calculate the share value
Hi all, i have a table like below (sample data) SPDDESC ACTvalue BOX 20 ...
- 4 years ago
Hi Anonymous ,
You can try below code:-
SPD_share = VAR selectedSPD = SELECTEDVALUE ( 'Table (3)'[SPDDESC] ) VAR totalsum = CALCULATE ( SUM ( 'Table (3)'[ACTvalue] ), ALL ( 'Table (3)' ) ) VAR selected_spddesc_value = CALCULATE ( SUM ( 'Table (3)'[ACTvalue] ), 'Table (3)'[SPDDESC] = selectedSPD ) RETURN DIVIDE ( ( selected_spddesc_value - totalsum ), selected_spddesc_value )Output:-
Thanks,
Samarth
Samarth_18
Community Champion
4 years agoHi Anonymous ,
You can try below code:-
SPD_share =
VAR selectedSPD =
SELECTEDVALUE ( 'Table (3)'[SPDDESC] )
VAR totalsum =
CALCULATE ( SUM ( 'Table (3)'[ACTvalue] ), ALL ( 'Table (3)' ) )
VAR selected_spddesc_value =
CALCULATE ( SUM ( 'Table (3)'[ACTvalue] ), 'Table (3)'[SPDDESC] = selectedSPD )
RETURN
DIVIDE ( ( selected_spddesc_value - totalsum ), selected_spddesc_value )
Output:-
Thanks,
Samarth