Forum Discussion

cuongtrinh2197's avatar
cuongtrinh2197
Frequent Visitor
2 years ago
Solved

Need urgent help please!!!

Hi, can someone show me the way to bring the field Customer part number to the visual table?

 

My relationship looks fine but the error happened when I tried to bring the customer part number to the table, If the customer doesn't have a specific part number for the part they bought, the return will be our part number.

 

Please find my attachment for details:
https://shorturl.at/uI99n

  • ryan_mayu's avatar
    ryan_mayu
    2 years ago

    cuongtrinh2197 

    pls see if this is what you want

     

    Measure =
    VAR _cpn=maxx(FILTER(fCustProduct,fCustProduct[Part number]=max(fSales[Part number])&& fCustProduct[Customer]=max(fSales[Customer])),fCustProduct[Customer Part Number])
    return if (_cpn="",max(fSales[Part number]),_cpn)
     

6 Replies

  • i think you need to improve the data model. 

    Now you can try to create a column

     

    customer part number = maxx(FILTER(fCustProduct,fCustProduct[Part number]=fSales[Part number]),fCustProduct[Customer Part Number])
     
     
    then add this column to the table visual
     
     
    • cuongtrinh2197's avatar
      cuongtrinh2197
      Frequent Visitor

      Many thanks Ryan,
      Is there any chance for me to use your syntax acting as a measure?
      My company just empowered me to do the measure and visual table without modifying the dataset such as add a new column,...

      • ryan_mayu's avatar
        ryan_mayu
        Super User

        pls try this

        Measure = maxx(FILTER(fCustProduct,fCustProduct[Part number]=max(fSales[Part number])),fCustProduct[Customer Part Number])