Forum Discussion

risingsun's avatar
risingsun
Regular Visitor
7 years ago

Average Total Based on Total Distinct Count Only

Hi,

 

I am new to Power Bi, so please bear with me.

 

The column I am looking to create in Power BI is the last one here (Average Cost - Complete Total) where The [Total Cost] is always divided by the same number - the Distinct Total of the whole company (25):

 

SiteDistinct Count of IDTotal CostAverage Cost (Site)Average Cost (Complete Total)
Site #1255367215215
Site #217234213894
Site #35135727154
Site #4256368255255
Site #5122984249119
Total25   

 

I tried using MAX, but it keeps giving me the Average Cost (Site) column instead.

 

Any ideas?

5 Replies

    • risingsun's avatar
      risingsun
      Regular Visitor
      This doesn't seem to work for me as my 'Distinct Count of ID' is a measure where: CountOfID = DISTINCTCOUNT(Table1[ID]) I get the error: Column 'CountofID' in 'Table1' cannot be found or may not be used this expression. Is there anyway around this? Thanks for your help!
      • v-yuta-msft's avatar
        v-yuta-msft
        Community Support

        risingsun,

         

        Since MAX(measure) can't work, so you should change measure CountOfID to calculate column and use the formula.

         

        Regards,

        Jimmy Tao

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

      risingsun,

       

      Have you solved your issue by now? If you have, could you please help mark the correct answer to finish the thread? Your contribution will be much appreciated.

       

      Regards,

      Jimmy Tao

  • Hi,

     

    Assuming columns 2 and 3 are measures, try this measure

     

    =[Total Cost]/CALCULATE([CountofID],ALL(Data[Site]))

     

    Hope this helps.