Forum Discussion

DennisSchlein's avatar
DennisSchlein
Icon for Helper III rankHelper III
3 years ago
Solved

Newbie - Basic Cost/Sales question

Hi  I have worked on structuring my data, to work in my power bi model. But working with it now, im not sure acuatly how to do it. The essense if I have 2 fact tables - Cost and Sales. ta...
  • amitchandak's avatar
    3 years ago

    DennisSchlein , Create a new column in the sales table

     

    new cost =

    Var _max = maxx(filter(cost, cost[Order] = sales[Order] && cost[TYpe] = sales[Type]), cost[Amount])

    var _max = maxx(filter(cost, cost[parcelNumber] = sales[parcelNumber] && cost[TYpe] = sales[Type]), cost[Amount])

    return

    coalesce(_max, _max1)

     

    or new column in cost

     

    new cost =

    Var _max = maxx(filter(sales, cost[Order] = sales[Order] && cost[TYpe] = sales[Type]), sales[sales Amount])

    var _max = maxx(filter(sales, cost[parcelNumber] = sales[parcelNumber] && cost[TYpe] = sales[Type]), sales[sales Amount])

    return

    coalesce(_max, _max1)