Forum Discussion
Create New Column from Main Product ID
Hi All Member,
I want to create new column "ComboID" from main "ProductID" as below example below
We have Papa Blazing Combo (Product ID: 101) and Sub Combo such as Chicken Wing (102) and Pizza (L) All The Meat (103).
So How can we create new column with insert only Main Product ID in by using Dax?
6 Replies
- Ashish_MathurSuper User
Hi,
Write this calculated column formula
=calculate(min(Data[Product ID]),filter(Data,Data[MasterItem]=earlier(Data[MasterItem])))
- VisalSengFrequent Visitor
Sorry for late reply. I try to do as your code but result is different. It is not correct yet.
Combo ID =calculate(min('Sales Table'[Product ID]),filter('Sales Table','Sales Table'[MasterItem]=earlier('Sales Table'[MasterItem])))- Ashish_MathurSuper User
What is wrong with that result. Explain clearly.
- AjithPrasathResolver II
Hi VisalSeng ,
Please use the below formula in the new column
=
CALCULATE(
MIN(Data[Product ID]),
ALLEXCEPT(Data, Data[MasterItem])
)PS: Please give kudos and mark this as the solution, if the answer is correct.
- VisalSengFrequent Visitor
Sorry for late reply.
I try your code but it doesn't correct as result I want yet. So any recommend more?
- AjithPrasathResolver II
Hi VisalSeng ,
I think it's working fine, beacuse we are taking min(product id) , so for each masteritem it's taking min(product id) and working correctly. If not correct, please explain