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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

DAX fix on Average function

Experts,

please help me to fix the below DAX code.

BalaKiranM_0-1662710102102.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

Please try this measure:

Measure = 
AVERAGEX(
    VALUES('Query1'[Index]),
    DIVIDE(
        CALCULATE(
            SUM('Query1'[Number of Orders]),
                'Query1'[Early Delivery Flag]="Y"
            )+0,
            CALCULATE(
                SUM('Query1'[Number of Orders]),
                ALL()
            )
        )
)

Where the value in 'Query1'[Index] is uniquely and not null. If the table 'Query1' does not have a column that meets such a condition, you can add a new column in the Power Query Editor.

vcgaomsft_0-1662949128246.png

vcgaomsft_1-1662949168441.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous ,

 

Please try this measure:

Measure = 
AVERAGEX(
    VALUES('Query1'[Index]),
    DIVIDE(
        CALCULATE(
            SUM('Query1'[Number of Orders]),
                'Query1'[Early Delivery Flag]="Y"
            )+0,
            CALCULATE(
                SUM('Query1'[Number of Orders]),
                ALL()
            )
        )
)

Where the value in 'Query1'[Index] is uniquely and not null. If the table 'Query1' does not have a column that meets such a condition, you can add a new column in the Power Query Editor.

vcgaomsft_0-1662949128246.png

vcgaomsft_1-1662949168441.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

tamerj1
Super User
Super User

Hi @Anonymous 
You can right it 
( DIVIDE formula + SUM formula ) /2

amitchandak
Super User
Super User

@Anonymous , Divide will already give an Average. If you need Avg of Avg , you need a level/group by column

 

You need a measure like

example

 

Averagex(Values(Table[Column]) , Calculate(Divide(Sum(Table[Val1]), Count[Table[Val2]))))

 

refer if needed

DAX vs SQL Part 9: Average of Sum https://www.youtube.com/watch?v=4xn0A43jBz8&list=PLPaNVDMhUXGZNyKU0PgG2g3P0c6CPjMnj&index=9

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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