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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
cosminc
Post Partisan
Post Partisan

Average Weighted on DAX - sumx

Hi all,

i'm struggling with an average, i translate below a similar example:

 
Salesmen  Sales Duration Year  Month
A              10         10         2019    1
A               5           20         2019   2
B               20        3            2019   2   
 
expected results in a table with 2019 selected:
top salesmen
 
Salesmen    Weighted Avg
A                      sumproduct(Sales,Duration)/sum(Duration)=6.6666
B                       20
 
i tried this but doesn't work
Weighted Avg = sumx(source,source[Sales]*source[Duration])/sum(source[Duration])
 
Thanks in advance!
Cosmin
 
      
1 ACCEPTED SOLUTION
Anonymous
Not applicable

This should work:

Weighted Sales = 
DIVIDE( 
    SUMX(FactSales, 
            FactSales[Sales] * FactSales[Duration] ), 
    SUM ( FactSales[Duration] )
)

 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

This should work:

Weighted Sales = 
DIVIDE( 
    SUMX(FactSales, 
            FactSales[Sales] * FactSales[Duration] ), 
    SUM ( FactSales[Duration] )
)

 

Hi,

it doesn't work unfortunately

it gives me same value for each Salesmen

Thanks

 

Anonymous
Not applicable

Hmm. Looks like it works for me?!

Weighted Avg.png

it works

my mistake

after 2 hours i realised that i made a column instead of a measure...

Thanks!

Cosmin

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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