Forum Discussion

KJMiles's avatar
KJMiles
New Member
1 year ago
Solved

Center of gravity

Hi All, I am trying to create CoG in power bi based on simple table with 4 columns: Franchise Name, qty, Longitude & Latitude. I have created a center of gravity query.

1 CoG_1 =
2 var qty = CALCULATE(SUM('Total volume'[qty]),ALLSELECTED('Total volume'))
3 var coglat = CALCULATE(SUMX(
4    'Total volume',
5        'Total volume'[Latitude] * 'Total volume'[qty]), ALLSELECTED('Total volume') )
6 var coglon = CALCULATE(SUMX(
7        'Total volume',
 
Error:Function ROW expects a column name as argument number 9. What I am missing ? Pls help!
8           'Total volume'[Longitude] * 'Total volume'[qty]), ALLSELECTED('Total volume') )
9 var divlat = DIVIDE(coglat, qty, 0 )
10 var divlon = DIVIDE(coglon, qty, 0 )
11 RETURN
12 ROW(  
13   "Franchise Name", "CoG",
14   "Latitude", divlat,
15    "Longitude", divlon,
16    "qty",0,
17 )

Error msg :Function ROW expects a column name as argument number 9. What I am missing? Pls help

  • Anonymous's avatar
    Anonymous
    1 year ago

    You have a comma after your zero. You have “qty”, 0,) instead of "qty", 0)

     

    --Nate

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    You have a comma after your zero. You have “qty”, 0,) instead of "qty", 0)

     

    --Nate

    • KJMiles's avatar
      KJMiles
      New Member

      OMG, yes thats rigth! Thnkas a lot