Forum Discussion

Mahmoodul's avatar
Mahmoodul
Icon for Helper I rankHelper I
5 years ago

How can we calculate Average

Can you please help me out to calculate Week wise Average call,

We have Call and Week column, i wanted to calculate Weekwise call, like below

 

Week    Call     Avg

wk1       11         2.2

wk2       22         4.4

wk3       33         6.6

wk4       44         8.8

wk5       55          11

 

Example-Week Count-5, so 11/5=2.2 or 22/5=4.4 like this.....

TomMartens 

10 Replies

  • Mahmoodul try this measure

    Avg = AVERAGEX ( VALUES ( YourTable[Week] ), CALCULATE ( SUM ( YourTable[Call] ) ) )

     

    Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS  I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

    Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

     

    • Mahmoodul's avatar
      Mahmoodul
      Icon for Helper I rankHelper I

      Hi parry2k Thanks for reply

      but it is giving me below result

      Wk1   Call    avg

      wk1     11     11.00

      wk2     22      22.00

      wk3     33     33.00

      wk4     44     44.00

      wk5     55     55.00

  • Mahmoodul  and what you want? what's wrong? Not fully sure how should I interpret your message.

     

    Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS  I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

    Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

  • KNP's avatar
    KNP
    Icon for Super User rankSuper User

    Hi Mahmoodul

     

    I'm not 100% clear how the 5 is calculated but you could try this...

     

    Measure = 
    VAR TotalCount = CALCULATE(COUNTROWS('YourTable'), ALL())
    RETURN
    DIVIDE(SUM('YourTable'[Call]), TotalCount)

     

    Hope this helps.

      • KNP's avatar
        KNP
        Icon for Super User rankSuper User

        Does my measure give you what you need?

  • Mahmoodul here is the measure:

     

    Week Avg = DIVIDE ( SUM ( WeekAvg[Call] ), CALCULATE ( DISTINCTCOUNT ( WeekAvg[Week] ), ALL () ) )

     

    Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS  I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

    Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

  • v-deddai1-msft's avatar
    v-deddai1-msft
    Icon for Community Support rankCommunity Support

    Hi Mahmoodul ,

     

    Please try to use the following measure:

     

    Avg = AVERAGEX ( VALUES ( YourTable[Week] ), CALCULATE ( SUM ( YourTable[Call] ) ) /CALCULATE(DISTINCTCOUNT ( YourTable[Week] ),ALL(YourTable)))

     

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

     

    Best Regards,

    Dedmon Dai