Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Find and mark items with given composition.

I have a couple of million rows of data is given below. CUSTOMER_NO SERVICE 11111111 AB 11111111 BC 11111111 XY 11111111 SA 55555555 AB 55555555 BC 5555...
  • TeigeGao's avatar
    7 years ago

    Hi Anonymous ,

    Please refer to the following steps:

    First create a calculated table to get the distinct value for each customer, please refer to the following DAX:

    Table = var a =  ADDCOLUMNS('Custom',"Marker",IF(LOOKUPVALUE(Service[MARKER],Service[SERVICE],'Custom'[Service]) = BLANK(),'Custom'[Service],LOOKUPVALUE(Service[MARKER],Service[SERVICE],'Custom'[Service])))
    return DISTINCT(SELECTCOLUMNS(a,"Cust",'Custom'[CUSTOMER_NO],"mark",[Marker]))

    Then create a calculated table to summarize them:

    Table 2 = SUMMARIZE('Table','Table'[Cust],"marker",CONCATENATEX('Table','Table'[mark],"+"))

    After that create a table to get the result:

    Table 3 = ADDCOLUMNS('Custom',"**Marker**",LOOKUPVALUE('Table 2'[marker],'Table 2'[Cust],'Custom'[CUSTOMER_NO]))

    The result will like below:

    Best Regards,

    Teige