Forum Discussion

VisalSeng's avatar
VisalSeng
Frequent Visitor
3 years ago

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

  • Hi,

    Write this calculated column formula

    =calculate(min(Data[Product ID]),filter(Data,Data[MasterItem]=earlier(Data[MasterItem])))

    • VisalSeng's avatar
      VisalSeng
      Frequent Visitor

      Ashish_Mathur 

       

      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])))

       

  • 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.

    • VisalSeng's avatar
      VisalSeng
      Frequent Visitor

      AjithPrasath 

       

      Sorry for late reply. 

      I try your code but it doesn't correct as result I want yet. So any recommend more?

       

       

  • 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