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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
AshDil
Helper V
Helper V

Want to show weighted average value DAX

Hi,

I have data as follows:

Category    HourRate    Value
C                4.44             94.09
D               8.13              100

I want to calculate following:

Weighted average factor for Category C : 4.44 / 12.57 (i.e,Sum of Hourrate for Cat C & D) = 0.353

Weighted average factor for Category D : 8.13 / 12.57 (i.e,Sum of Hourrate for Cat C & D) = 0.647

And I want to show the following in KPI

In Slicer Cat C is selected,

Measure value = 94.09 

In Slicer Cat C & D are selected,

Measure Value = 94.09 * 0.353 + 100 * 0.647 = 97.89

 

Please help me to do.

 

Thanks,

AshDil.

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @AshDil ,

You can create a measure as below to get it:

Measure = 
VAR _sumofrate =
    CALCULATE ( SUM ( 'Table'[HourRate] ), ALLSELECTED ( 'Table' ) )
VAR _tab =
    ADDCOLUMNS (
        'Table',
        "nvalue", 'Table'[Value] * DIVIDE ( 'Table'[HourRate], _sumofrate )
    )
RETURN
    SUMX ( _tab, [nvalue] )

yingyinr_0-1628844775671.png

Best Regards

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @AshDil ,

You can create a measure as below to get it:

Measure = 
VAR _sumofrate =
    CALCULATE ( SUM ( 'Table'[HourRate] ), ALLSELECTED ( 'Table' ) )
VAR _tab =
    ADDCOLUMNS (
        'Table',
        "nvalue", 'Table'[Value] * DIVIDE ( 'Table'[HourRate], _sumofrate )
    )
RETURN
    SUMX ( _tab, [nvalue] )

yingyinr_0-1628844775671.png

Best Regards

Hi @Anonymous ,

Thanks. It worked.

Regards,

AshDil

Vera_33
Resident Rockstar
Resident Rockstar

Hi @AshDil 

 

Here is one way, assume the slicer column from your fact table

test = 
VAR T1=ADDCOLUMNS('yourTable',"AVG",'yourTable'[HourRate]/SUM('Table'[HourRate])*'yourTable'[Value])
RETURN
SUMX(T1,[AVG])

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors