Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi all,
I have two queries that i would to join...
So first query is a table of 3 columns (Date, product, Quantity) and for this one i have everyday of a year
for the second query, i have 4 columns (Date, product, price, segment product) but only 4 point of data per year per product (it's a pricing policy/strtegy)
my objective is to add the price columns to my first table, to be able to simply multiply my quantity by princing decided by corporate.
Thanks a lot
Let me know if i can be more precise
Solved! Go to Solution.
Hi @gpp007 ,
First create a column in query 2:
next period =
var _next= CALCULATE(MIN('Table'[Date]),FILTER('Table','Table'[Date]>EARLIER('Table'[Date])&&'Table'[Product]=EARLIER('Table'[Product])))
Return
IF(_next=BLANK(),DATE(YEAR(MAX('Table'[Date])),12,31),_next)
Then create a measure as below:
_cost =
CALCULATE(MIN('Table'[Price]),FILTER('Table','Table'[Date]<=MAX('Query 1'[Date])&&'Table'[next period]>=MAX('Query 1'[Date])&&'Table'[Product]=MAX('Query 1'[Product])))
And you will find that the price has been added to query 1 according to period setting.
For the related .pbix file,pls see attached.
Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!
@gpp007 , a new column like
minx(filter(table2, table1[product] =table2[product] && table1[Date] = table2[Date]),table2[price])
or
minx(filter(table2, table1[product] =table2[product] && year(table1[Date]) = year(table2[Date])),table2[price])
hi amitchandak
thanks for quick reply, i used your method, but it partially worked... the difficulty is to have a changing price between period, if i use your method, on my new column i only have the data i need at one date vs all date (in order to calculate turnover etc).
Hi @gpp007 ,
First create a column in query 2:
next period =
var _next= CALCULATE(MIN('Table'[Date]),FILTER('Table','Table'[Date]>EARLIER('Table'[Date])&&'Table'[Product]=EARLIER('Table'[Product])))
Return
IF(_next=BLANK(),DATE(YEAR(MAX('Table'[Date])),12,31),_next)
Then create a measure as below:
_cost =
CALCULATE(MIN('Table'[Price]),FILTER('Table','Table'[Date]<=MAX('Query 1'[Date])&&'Table'[next period]>=MAX('Query 1'[Date])&&'Table'[Product]=MAX('Query 1'[Product])))
And you will find that the price has been added to query 1 according to period setting.
For the related .pbix file,pls see attached.
Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
72 | |
67 | |
51 | |
38 | |
26 |
User | Count |
---|---|
89 | |
52 | |
45 | |
39 | |
38 |