Forum Discussion

samflynn's avatar
samflynn
Frequent Visitor
8 years ago
Solved

Repeat value for each row

I have the following table: 


Where $ Amount, net wt, are measures. (both are basically Amount USD and Net Weight, but with a RELATEDTABLE() filter)

CostPerLb = [$Amount]/[net wt]

 

 

 

 

I want the value 0.1458 to repeat for each row in the avg CostPerLb (for example). 

My end goal with this is that: I can multiply the average (0.1458) to Net Weights that have no Amount associated with them to get a amount value for all the shipments in the table. 

  • Hi,

     

    Your measur of avg CosrPerLb should be something like this

     

    =IF(ISBLANK([$Amount]),CALCULATE([CostPerLb],ALL(Data[BillofLad]),ALL(Data[Shipment])),[your existing measure of avg CosrPerLb])

     

    Does this work?

     

     

2 Replies

  • Hi,

     

    Your measur of avg CosrPerLb should be something like this

     

    =IF(ISBLANK([$Amount]),CALCULATE([CostPerLb],ALL(Data[BillofLad]),ALL(Data[Shipment])),[your existing measure of avg CosrPerLb])

     

    Does this work?

     

     

  • Hi samflynn,

     

    Believe that you want to have the total value for all the table just change you measure to:

     

    CostPerLb =CALCULATE([$Amount]/[net wt]; ALL(Table[Colum]))

    This will give you the same result for all rows.

     

    However the way you set up your question is not perceivable what you want please check https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490 in order to get a better answer ( Greg_Deckler post a great datanaut).

     

    Regards,

    MFelix