Forum Discussion

viralpatel21's avatar
viralpatel21
Helper II
5 years ago
Solved

Calculate Average Balance

Hello World

 

I am trying to calculate the average balance using 2 measure. But i am not sure how?

 

my 2 measure are

Total Balance =

CALCULATE (
SUM ( au_bitgowallets[au_balance] ),
USERELATIONSHIP(au_bitgowallets[CreatedDate],FeeDate[Date])
)
Number of Wallet with balance =
CALCULATE(DISTINCTCOUNT(au_bitgowallets[au_bitgowalletid]),
FILTER(au_bitgowallets,au_bitgowallets[au_balance] > 0),
USERELATIONSHIP(FeeDate[Date],au_bitgowallets[CreatedDate]))

 

 

hope this makes sense 🙂

thanks

viral

  • Hi viralpatel21 ,

    The average balance is equal to the total balance divided by the number of wallets.

    Average Balance=
    var Total_Balance =
    CALCULATE (
        SUM ( au_bitgowallets[au_balance] ),
        USERELATIONSHIP ( au_bitgowallets[CreatedDate], FeeDate[Date] )
    )
    var Number_balance =
    CALCULATE (
        DISTINCTCOUNT ( au_bitgowallets[au_bitgowalletid] ),
        FILTER ( au_bitgowallets, au_bitgowallets[au_balance] > 0 ),
        USERELATIONSHIP ( FeeDate[Date], au_bitgowallets[CreatedDate] )
    )
    
    RETURN  Total_Balance/Number_balance

    You can substitute the measure into pbix to see if the final result is accurate.

     

    Wish it is helpful for you!

     

    Best Regards

    Lucien

3 Replies

  • v-luwang-msft's avatar
    v-luwang-msft
    Community Support

    Hi viralpatel21 ,

    The average balance is equal to the total balance divided by the number of wallets.

    Average Balance=
    var Total_Balance =
    CALCULATE (
        SUM ( au_bitgowallets[au_balance] ),
        USERELATIONSHIP ( au_bitgowallets[CreatedDate], FeeDate[Date] )
    )
    var Number_balance =
    CALCULATE (
        DISTINCTCOUNT ( au_bitgowallets[au_bitgowalletid] ),
        FILTER ( au_bitgowallets, au_bitgowallets[au_balance] > 0 ),
        USERELATIONSHIP ( FeeDate[Date], au_bitgowallets[CreatedDate] )
    )
    
    RETURN  Total_Balance/Number_balance

    You can substitute the measure into pbix to see if the final result is accurate.

     

    Wish it is helpful for you!

     

    Best Regards

    Lucien

  • v-luwang-msft's avatar
    v-luwang-msft
    Community Support

    Hi viralpatel21 ,

    Has your problem been solved, if so, please consider Accept a correct reply as the solution or share your own solution to help others find it.

    Best Regards
    Lucien