Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hello All,
Please help me with returning the latest price of an item at a specific store from one table to another's column (table from SQL source, not a matrix visual)
In Table1 from SQL I have inventory information like:
Date / StoreID / itemID / Qty
22.11.2022 / store1 / item1 / 13 pieces
22.11.2022 / store2 / item1 / 10 pieces
22.11.2022 / store1 / item2 / 5 pieces
In Table2 from SQL I have sale prices like:
Date / StoreID / ItemID / UnitPrice
11.11.2022 / store1 / item1 / €3/unit
10.11.2022 / store1 / item1 / €5/unit
01.11.2022 / store2 / item1 / €4,5/unit
01.11.2022 / store1 / item2 / €4/unit
...
What I want to achieve is to return the last sales price of the items in Table1 into a new column.
The result should look like this in Table1:
Date / StoreID / itemID / Qty / UnitPrice
22.11.2022 / store1 / item1 / 13 pieces / €3
22.11.2022 / store2 / item1 / 10 pieces / €4,5
22.11.2022 / store1 / item2 / 5 pieces / €4
It's important that each item in a specific store will have a uniqe price for the last date.
Thank you!
Solved! Go to Solution.
you can try this to create a column
Column =
var _date=maxx(FILTER(Table2,Table1[storeID]=Table2[store]&&Table1[ItemID]=Table2[item]&&'Table1'[date]>='Table2'[date]),'Table2'[date])
return maxx(FILTER(Table2,Table1[storeID]=Table2[store]&&Table1[ItemID]=Table2[Item]&&'Table2'[date]=_date),Table2[unitprice])
pls see the attachment below
Proud to be a Super User!
you can try this to create a column
Column =
var _date=maxx(FILTER(Table2,Table1[storeID]=Table2[store]&&Table1[ItemID]=Table2[item]&&'Table1'[date]>='Table2'[date]),'Table2'[date])
return maxx(FILTER(Table2,Table1[storeID]=Table2[store]&&Table1[ItemID]=Table2[Item]&&'Table2'[date]=_date),Table2[unitprice])
pls see the attachment below
Proud to be a Super User!
Hi,
Thank you!
Column =
var _date=maxx(FILTER(Table2,Table1[storeID]=Table2[store]&&Table1[ItemID]=Table2[item]&&'Table1'[date]>='Table2'[date]),'Table2'[date])
return maxx(FILTER(Table2,Table1[storeID]=Table2[store]&&Table1[ItemID]=Table2[Item]&&'Table2'[date]=_date),Table2[unitprice])
you are welcome
Proud to be a Super User!
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.
| User | Count |
|---|---|
| 47 | |
| 44 | |
| 40 | |
| 20 | |
| 15 |
| User | Count |
|---|---|
| 70 | |
| 68 | |
| 32 | |
| 27 | |
| 25 |