cancel
Showing results for
Did you mean:

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Frequent Visitor

## Stop a weighting measure running when in the SUMX function

Hello everyone,

I am trying to use a weighting measure inside a SUMX function and at each iteration of the SUMX, the weight becomes 100% because it is recalculating the weight for the specific row instead of doing it for the few items that are selected.

I managed to get close to the answer as I have the dynamic weight working when I put it in a table ans select countries with my slicer, but as soon as I put the measure Dynamic Weight in

Here is the code of the measures :

SUMX Dynamic Weight * KPIS =

Calculate(
sumx(
'KPIs',
'KPIs'[KPI]
*
'Table'[Dynamic Weight],
ALLSELECTED(Mapping[Country]) )

Dynamic Weight =

CALCULATE

DIVIDE([Sales],
Calculatesum('Table'[Sales]) , ALLSELECTED('Mapping'[Country] ))
) )

I guess I need to find a way to tell the SUMX function to keep the weight of each countries that are selected in the slicer and not to recalculate it on each iteration but I have not been able to find a solution yet, any help is much appreciated!

Thanks a lot,
Stan
1 ACCEPTED SOLUTION
Super User

try this

SUMX Dynamic Weight * KPIS =SUMX(ALLSELECTED(Mapping[Country]),'KPIs'[KPI]*'Table'[Dynamic Weight])

4 REPLIES 4
Super User

@Standef

``````SUMX Dynamic Weight * KPIS =
CALCULATE (
SUMX (
'KPIs',
'KPIs'[KPI] * CALCULATE ( [Dynamic Weight], ALL ( Mapping[Country] ) )
),
ALLSELECTED ( Mapping[Country] )
)``````
Frequent Visitor

Hey @tamerj1, thanks for the reply!
Jjust tried that and unfortunately it givesthe same output as before...

Super User

try this

SUMX Dynamic Weight * KPIS =SUMX(ALLSELECTED(Mapping[Country]),'KPIs'[KPI]*'Table'[Dynamic Weight])

Frequent Visitor

Hello @wdx223_Daniel
Amazing, this works exactly like I need it to.

Thank you very much!

Have a nice weekend!

Stan

Announcements

#### Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

#### Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

#### The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors