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
lchi08978
Frequent Visitor

How can I sum each average value in one measure

Hi ,

I have a dataset like below:

lchi08978_0-1656998032975.png


I've calculate average 'Duration' group by 'Application',

DAX: avg_duration = CALCULATE(AVERAGEX('AP tbltimecard_engineering_system',

                                                                        'AP tbltimecard_engineering_system'[Duration]),
                                                      ALLSELECTED('AP tbltimecard_engineering_system'[Year_Week]))
 
result :
lchi08978_2-1656999253976.png

 


 

my next step is get sum of each application's average value
sum_average = 0.35 + 0.16 + 0.72 = 1.23
like below,
lchi08978_4-1656999555777.png

now I write hard code '1.23' into a measure ,

and I've tried every solution that I know on DAX,but still can't do what I want.

How do i do this?
Thank you for read to here .
1 ACCEPTED SOLUTION

Hi @lchi08978 ,

 

I suggest you to try this code to create [avg_duration] measure.

avg_duration = 
VAR _SUMMAZIRE = 
SUMMARIZE (
    'AP tbltimecard_engineering_system',
    'AP tbltimecard_engineering_system'[ApplicationName],
    "avg_duration",
        CALCULATE (
            AVERAGE ( 'AP tbltimecard_engineering_system'[Duration] ),
            ALLEXCEPT (
                'AP tbltimecard_engineering_system',
                'AP tbltimecard_engineering_system'[ApplicationName]
            )
        )
)
RETURN
SUMX(_SUMMAZIRE,[avg_duration])

Result is as below.

RicoZhou_0-1657268639441.png

 

Best Regards,
Rico Zhou

 

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

4 REPLIES 4
Kishore_Kadhir
Resolver II
Resolver II

Hi @lchi08978 

 

Can you try the below measure and see if it works?

 

Sum of Average =
CALCULATE(
SUMX('AP tbltimecard_engineering_system',
CALCULATE(AVERAGE('AP tbltimecard_engineering_system'[Duration]), ALLEXCEPT('AP tbltimecard_engineering_system', 'AP tbltimecard_engineering_system'[ApplicationName]))
/
CALCULATE(COUNT('AP tbltimecard_engineering_system'[ApplicationName]),
ALLEXCEPT('AP tbltimecard_engineering_system', 'AP tbltimecard_engineering_system'[ApplicationName]))),
ALL('AP tbltimecard_engineering_system'))

Kishore_Kadhir_0-1657274854410.png

 

Regards,
Kishore

 

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

amitchandak
Super User
Super User

@lchi08978 , Try a measure like

 

calculate( AverageX(Values('AP tbltimecard_engineering_system'[Application Name]), [avg_duration ]), allselected())

Hi @amitchandak ,

 

I tried your measure,but the output seems not I want,

result:

lchi08978_0-1657008335200.png


did I write something wrong?

and thank you for your reply!

Hi @lchi08978 ,

 

I suggest you to try this code to create [avg_duration] measure.

avg_duration = 
VAR _SUMMAZIRE = 
SUMMARIZE (
    'AP tbltimecard_engineering_system',
    'AP tbltimecard_engineering_system'[ApplicationName],
    "avg_duration",
        CALCULATE (
            AVERAGE ( 'AP tbltimecard_engineering_system'[Duration] ),
            ALLEXCEPT (
                'AP tbltimecard_engineering_system',
                'AP tbltimecard_engineering_system'[ApplicationName]
            )
        )
)
RETURN
SUMX(_SUMMAZIRE,[avg_duration])

Result is as below.

RicoZhou_0-1657268639441.png

 

Best Regards,
Rico Zhou

 

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

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.