Forum Discussion

dswinden's avatar
dswinden
Icon for Helper II rankHelper II
3 years ago
Solved

Calculated Column Based on Two OTHER Related Tables (three tables total)

Hello!

 

I am trying to connect a sales source to a date table, and a price table.  (example below)

I am trying to determine what the unit price was on a given week for a SKU so that I can calculate Net Revenue from a table that is reporting Gross Revenue (the finance logic is calculated in our Finance Pricing Sheet table #3 already).

 

Table 1 (Data Source):

DateSKU NumberGross Revenue 
Oct 5, 2022123456$2000
Oct 6, 2022123456$5000

 

Table 2 (Date Table): 

DateWeek StartMonth Start
Oct 5, 2022Oct 3, 2022Oct 1, 2022
Oct 6, 2022Oct 3, 2022Oct 1, 2022

 

Table 3 (Finance Pricing Sheet): 

Week StartSKU NumberNet Revenue Unit Price
Oct 3123456$20.99
Oct 10123456$29.99
Oct 17123456$25.99
  • Hi,

    Create a relationship (Many to one and Single) from the Date column of the Date table to the Date column of the Calendar Table.  Write these calculated column formulas

    Week start = =RELATED('Calendar'[Week Start])
    Unit price = CALCULATE(MAX(Finance_pricing[Net Revenue Unit Price]),FILTER(Finance_pricing,Finance_pricing[SKU Number]=EARLIER(Data[SKU Number])&&Finance_pricing[Week Start]=EARLIER(Data[Week start])))

    Hope this helps.

9 Replies

    • dswinden's avatar
      dswinden
      Icon for Helper II rankHelper II

      Hi ryan_mayu !

       

      I would like to be able to look up the price of an item on a given week.  I have hundreds of SKU's and the prices can change week to week depending on price promotions.  This is a dumb analogy, but in excel I would do;


      sumifs(Price Column, Week Start Column, Week Start Lookup, Sku Number Column, Sku Number Lookup)

      OR

      What was the price of SKU 123456 on week of October 10th.  Answer $29.99

      • Ashish_Mathur's avatar
        Ashish_Mathur
        Icon for Super User rankSuper User

        Hi,

        So in the first table you want to create a calculated column formula which will return the price.  Am i right.  If yes, then share a calendar table with 2 columns - Date and Week start date (share this for a few months atleast).