Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

calculate the share value

Hi all,

 

i  have a  table like  below (sample data)

 

  SPDDESC                                                                           ACTvalue

 

 BOX 20                                                                            1000

MNT  20                                                                     500

RED 20                                                                 600

 

i having like  around 50 SPD Desc .  i want calculate  SPD share for individual share 

 

 for Example if i choose KSBOX20  desc 

 calculation should be 

  

SPD share =  (BOX 20 -ACTvaluetoal)/BOX20  

 

SPD share =  (1000 -2100)/1000.

 

 i want to set this formula for all SPDDESC    . any idea. i have tired selected value function  but  not work. thanks in advance 

 

 

 

 

1 ACCEPTED SOLUTION
Samarth_18
Community Champion
Community Champion

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:-

Samarth_18_0-1639055149488.png

Thanks,

Samarth

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

@Samarth_18   Thank you so much

Samarth_18
Community Champion
Community Champion

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:-

Samarth_18_0-1639055149488.png

Thanks,

Samarth

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.