Forum Discussion

AtchayaP's avatar
AtchayaP
Helper V
4 years ago

Dax

  • I have a string in a column , have to calculate average ? What method should use?

 

What is average x? Can you explain with easy example

3 Replies

  • v-henryk-mstf's avatar
    v-henryk-mstf
    Community Support

    Hi AtchayaP ,

     

    AVERAGEX: Returns the average of the expressions computed for each row of the table.

    for example:

    AVERAGEX(Sales, Sales[Quantity] * Sales[UnitPrice])

    The formula calculates the average of the Sales table sales, where the sales are not the initial columns of the table, but are calculated by AVERAGEX.

     

    You can count the number of different groups and find the average. See below:

    Col =
    VAR cur =
        CALCULATE (
            COUNTROWS ( 'Table' ),
            ALL ( 'Table' ),
            'Table'[Col] = EARLIER ( 'Table'[Col] )
        )
    RETURN
        AVERAGEX ( 'Table', cur )

     

    If the problem is still not resolved, please provide test data and screenshots of the desired results. Looking forward to your reply.


    Best Regards,
    Henry


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