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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Oleg222
Helper II
Helper II

Measure in totals

Please help with the measure - there is a flat table according to which the indicator is calculated:

 

Weighted Average3 =
DIVIDE (
SUMX (
VALUES ( Table3[Date] ),
CALCULATE ( SUM ( Table3[Value] ), Table3[Measures] = "Efficiency" )
* CALCULATE ( SUM ( Table3[Value] ), Table3[Measures] = "Weight" )
),
SUMX (
VALUES ( Table3[Date] ),
IF ( CALCULATE ( SUM ( Table3[Value] ), Table3[Measures] = "Efficiency" ), 1 )
* CALCULATE ( SUM ( Table3[Value] ), Table3[Measures] = "Weight" )
)
)

 

If you count separately for the branch, then everything is fine, but in the total amount the value is incorrect.
Please tell me:
- how effective is this measure (the denominator needs the filter "Efficiency" <> 0, so I used IF ( CALCULATE ( SUM ( Table3[Value] ), Table3[Measures] = "Efficiency" ), 1 ))
- how to fix the total indicator.

 

https://drive.google.com/file/d/1s1mlFoqKb-eLB0wKqvSL_XcVz6y0eMKd/view?usp=sharing

 

1 ACCEPTED SOLUTION

Hi @Oleg222 ,

 

Try the following formula:

 

Measure = 
DIVIDE(
    SUMX(
        SUMMARIZE( Table3, Table3[Date], Table3[Branch] ),
        [Efficiency] * [Weight]
    ),
    SUMX(
        VALUES(Table3[Date]),
        IF ( CALCULATE ( SUM ( Table3[Value] ), Table3[Measures] = "Efficiency" ), 1 )
            * CALCULATE ( SUM ( Table3[Value] ), Table3[Measures] = "Weight" )
    )
)

image.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

10 REPLIES 10
Oleg222
Helper II
Helper II

@v-kkf-msft The problem was not solved. Unfortunately, I don't know how to explain the logic of the formula. There are daily data on the indicator (moisture) and product weight. A formula for calculating the weighted average is required - for calculating by periods (weeks, months, years).

Hi @Oleg222 ,

 

I'm not sure if my understanding is correct. I think column "Efficiency" is the variable and column "Weight" is the corresponding weight.  Does the total part you said it is incorrect mean the part shown in the red circle in the figure below? The calculation formula of the total part I understand is 

           (0.07*636.5+0.07*626.74+0.03*602.9+0.02*621.6)/(636.5+626.74+602.9+621.6) = 0.048
Where does it have a problem?
 

image.png

 

Best Regards,
Winniz

@v-kkf-msft  The problem in All, its incorrect (I think the problem is in the numerator - in the total, the sum "Efficiency" is multiplied with the sum of the denominator, but it should be multiplied every day (weighted average)).

Oleg222_0-1626161990319.png

 

Hi @Oleg222 ,

 

Try the following formula:

 

Measure = 
DIVIDE(
    SUMX(
        SUMMARIZE( Table3, Table3[Date], Table3[Branch] ),
        [Efficiency] * [Weight]
    ),
    SUMX(
        VALUES(Table3[Date]),
        IF ( CALCULATE ( SUM ( Table3[Value] ), Table3[Measures] = "Efficiency" ), 1 )
            * CALCULATE ( SUM ( Table3[Value] ), Table3[Measures] = "Weight" )
    )
)

image.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

@v-kkf-msft  Thank you. It seems to work.

v-kkf-msft
Community Support
Community Support

Hi @Oleg222 ,

 

Does your problem have been solved? 

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

 

Best Regards,
Winniz

Oleg222
Helper II
Helper II

@aj1973  "Efficiency" in different periods, weighted by "Weight". The result by periods and by branches is OK, but the total amount is not correct. 

Oleg222_1-1625503756706.png

 

 

Hi @Oleg222 ,

 

I don't understand your formula. It seems to me that the calcalation result of measure "Weighted Average3" is the same as the result of measure "Efficiency".

 

Could you please give me an example of what total value you expect?

 

Best Regards,
Winniz

Oleg222
Helper II
Helper II

I think the problem is in the numerator - in the total, the sum "Efficiency" is multiplied with the sum of the denominator, but it should be multiplied every day (weighted average).

aj1973
Community Champion
Community Champion

Hi @Oleg222 

Your formula is not clear! Avarage of what that you want to see? you want to DIVIDE what by what?

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors