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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Standef
Helper I
Helper I

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 

Standef_1-1676573830839.png

 

 

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
wdx223_Daniel
Super User
Super User

try this

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

View solution in original post

4 REPLIES 4
tamerj1
Super User
Super User

@Standef 
Please try

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

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

wdx223_Daniel
Super User
Super User

try this

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

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

Thank you very much! 

Have a nice weekend!

Stan

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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

Top Solution Authors