Forum Discussion
Help with Dax query
Hi all,
I was trying to perform a DAX query to create a new column with the following scenario:
I have two tables, the first one is the a Price table. Incidate the price that it had an article during the living time.
If there is no date in EndDate it means that is the current price for this article.
And the other ones is a sales table , a register of code and sales date.
The idea here taking in account the sales date of the sales table, search in the price table tacking account the satrt and end date to have the price that the article had in the moment of the sale.
Attached the link of the powerbi document with te two exampe tables:
I hope you can help me .
Anonymous
//new column in sales table
price = maxx(filter(Price , sales[NationalCode] =Price[NationalCode] && sales[date] >= price[Start Date] && (isblank(price[end date]) || sales[date] <= price[End Date])),price[price])
1 Reply
- amitchandakSuper User
Anonymous
//new column in sales table
price = maxx(filter(Price , sales[NationalCode] =Price[NationalCode] && sales[date] >= price[Start Date] && (isblank(price[end date]) || sales[date] <= price[End Date])),price[price])