Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

calculate the share value

Hi all,   i  have a  table like  below (sample data)     SPDDESC                                                                           ACTvalue    BOX 20                                    ...
  • Samarth_18's avatar
    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