Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

Multiply table1 column 1 from table 2 column 2

I have this table here i want to multiply cost from table 1 into sales from table 2 any help? i build a relationship with table 1 and table 2 according to the date with caardianilty many to many and cross filter to both.

 

Table 1      Table 2   
 datecostsalescost per day   datesalescost per day
 10/5/2021"cost is fixed at 10 because <2022"70"=" cost *sales per day   30/4/202170"="  table1[cost] *sales per day
 10/20/2021 40    9/29/202167 
 1/5/2022321    1/5/202250 
 9/4/2022668    9/4/2022190 
 9/5/2022755    9/5/202290 
 9/6/2022365    9/6/202255 
 9/7/2022489    9/7/2022120 

6 Replies

  • tamerj1's avatar
    tamerj1
    Community Champion

    Hi Anonymous 

    since the relationship is many to many that means in some dates there is multiple costs. Therefore you have to provide a preference on which price would you like to consider; the max, min or average?

    • Anonymous's avatar
      Anonymous
      Not applicable

      well i dont want any of that i just want to multiply the cost by the sales no average no min no max just cost * sale and thats it any clue?

      • tamerj1's avatar
        tamerj1
        Community Champion

        Anonymous 
        I believe you misunderstood my reply. 
        in some instances you might not have a single value of the cost rather it will be multiple cost values in a single day. Then providing a preference is not an option it is a must. 

  • tamerj1's avatar
    tamerj1
    Community Champion

    Hi Anonymous 

    please create a calculated column in table2 

    cost per day =
    Table2[Sales] * AVERAGEX ( RELATEDTABLE ( Table1 ), Table1[Cost] )