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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
THENNA_41
Post Partisan
Post Partisan

SPD share Calculation

 i have table name called Master DB .  My table  data looks like the below .

 

Category Dec             Market name            Actuals

 Cigarettes                    AZ                              500

 Cigarettes                    AU                              300

 Cigarettes                   ZM                              200

      RRP                         AZ                              600

      RRP                        AU                              100

      RRP                       ZM                                350

 

 

 

I want calcualte SPD share  for individual  Market name total of the  individual   Category Dec   actuals

 

if suppose  going to calculate spd share for  AZ  for  Cigarettes  category .

 

Cigarettes  totalactuals =1000     

AZ  value for  Category = 500

 

my calculation should be like

 SPD share = ( selected Category Dec   total - selected marketname value) / selected Category Dec   total

 

  Example :  SPD share =(1000-500)/ 1000

 

 

i have created formula below 

 

SPD SHARE =

VAR selectedSPD =
SELECTEDVALUE ( 'Master DB'[Category Dec] )
VAR totalsum =
CALCULATE ( SUM ( 'Master DB'[Actuals] ), ALL ( 'Master DB' ) )
VAR selected_spddesc_value =
CALCULATE ( SUM ( 'Master DB'[Actuals] ), 'Master DB'[Category Dec] = selectedSPD )
RETURN
DIVIDE ( ( selected_spddesc_value - totalsum ), selected_spddesc_value )

 

 

But its taking whole actuals value . i want selected actuals value for the calcualtion.

 

 

thanks in advance .

 

1 ACCEPTED SOLUTION

@THENNA_41 ,

That will be

New measure =

var _cat = CALCULATE ( SUM ( 'Master DB'[Actuals] ), 'Master DB'[Category Dec] = max( 'Master DB'[Category Dec] ) )

var _self = SUM ( 'Master DB'[Actuals] )

return

divide(_cat -_self,_cat)

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

5 REPLIES 5
THENNA_41
Post Partisan
Post Partisan

@amitchandak  sir i am getting Failed to resolve name 'SELECTEDVALUE'. It is not a valid table, variable, or function name error  

THENNA_41
Post Partisan
Post Partisan

@amitchandak  sir  Not able get that 1000 -500/1000   
For example 1000  -  this is  total value for selected  Cigarettes category desc  .

                     500 - selected market value .

 let me use above  your mentiond measure  sir  

@THENNA_41 ,

That will be

New measure =

var _cat = CALCULATE ( SUM ( 'Master DB'[Actuals] ), 'Master DB'[Category Dec] = max( 'Master DB'[Category Dec] ) )

var _self = SUM ( 'Master DB'[Actuals] )

return

divide(_cat -_self,_cat)

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

@amitchandak  let me try  and will update now sir 

amitchandak
Super User
Super User

@THENNA_41 , Not able get that 100 -500/100

 

but need be like

 

SPD SHARE =

VAR selectedSPD =
SELECTEDVALUE
VAR totalsum =
CALCULATE ( SUM ( 'Master DB'[Actuals] ), ALL ( 'Master DB' ) )
VAR _select_cat =
CALCULATE ( SUM ( 'Master DB'[Actuals] ), 'Master DB'[Category Dec] = max( 'Master DB'[Category Dec] ) )
VAR _select_mar =
CALCULATE ( SUM ( 'Master DB'[Actuals] ), 'Master DB'[ Market name] = max( 'Master DB'[ Market name] ) )
RETURN
DIVIDE ( ( _select_cat - _select_mar ), totalsum )

 

 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.