Forum Discussion
Calculated column with variable periods
- 6 years ago
create a new column in supplies
supply end Date = minx(filter(supplies,supplies[product id]=earlier(supplies[product id]) && supplies[Supply Date]> earlier(supplies[Supply Date])),supplies[Supply Date])create a new column in sales
cost = minx(filter(sales,sales[sales_date]>=supplies[Supply Date]
&& (isbalnk(supplies[supply end Date]) || sales[sales_date] <supplies[supply end Date])),supplies[cost for 1 pc])Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges
Connect on Linkedin - 6 years ago
Hi D3K ,
We can also create a calculated column in Sales Table to meet you requeriement:
Cost Price for 1 pc = VAR i = [Product ID] VAR d = [Sales Date] RETURN CALCULATE ( SUM ( 'Supplies'[Cost price for 1 pc] ), FILTER ( 'Supplies', 'Supplies'[Product ID] = i && 'Supplies'[Supply Date] = CALCULATE ( MAX ( 'Supplies'[Supply Date] ), FILTER ( 'Supplies', 'Supplies'[Product ID] = i && 'Supplies'[Supply Date] <= d ) ) ) )
Best regards,
create a new column in supplies
supply end Date = minx(filter(supplies,supplies[product id]=earlier(supplies[product id]) && supplies[Supply Date]> earlier(supplies[Supply Date])),supplies[Supply Date])
create a new column in sales
cost = minx(filter(sales,sales[sales_date]>=supplies[Supply Date]
&& (isbalnk(supplies[supply end Date]) || sales[sales_date] <supplies[supply end Date])),supplies[cost for 1 pc])
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges
Connect on Linkedin