Forum Discussion

KristinaSp's avatar
KristinaSp
Icon for Helper I rankHelper I
5 years ago
Solved

Simple average from measure averages by category

Hi,

 

I have the task, that is very simple in excel, but I cant figure out it in Powerbi desktop.

This is the data sample:

I need to calculate average profitability liek in the example.

 

PlaceIncome          Net profit                 Net profitability
A1000101,00%
B2000201,00%
C1500040,03%
Total18000340,19%
    
I need: (1+1+0,03)/3 =0,68%

 

My measure DIVIDE (SUM(net profit), SUM(income)) gives me 0.19%, while I need to get 0.68%.

 

Please help me with this task.

 

Best wishes,

Kristina

 

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi KristinaSp ,

     

    You can create a new measure

    new Net profitability = var _total=SUMX('Table',[Net profitability])
    return IF(ISINSCOPE('Table'[Place]),[Net profitability],DIVIDE(_total,COUNT('Table'[Place])))

     

     

     

    Best Regards,

    Stephen Tao

     

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

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi KristinaSp ,

     

    You can create a new measure

    new Net profitability = var _total=SUMX('Table',[Net profitability])
    return IF(ISINSCOPE('Table'[Place]),[Net profitability],DIVIDE(_total,COUNT('Table'[Place])))

     

     

     

    Best Regards,

    Stephen Tao

     

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

  • Hi,

    Write these measures:

    Total income = SUM(Data[Income          ])
    Total profit = SUM(Data[Net profit                 ])
    Net profitability (%) = DIVIDE([Total profit],[Total income])
    Measure = if(hasonevalue(Data[Place]),[Net profitability (%)],AVERAGEX(VALUES(Data[Place]),[Net profitability (%)]))

    Hope this helps.