Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Resumir/agrupar columnas

Hola a todos, tienen una tabla de clientes, algunos de los cuales tienen varios Customer IDs (como Microsoft en la tabla de ejemplo), pero realmente me gustaría clasificar esto como un cliente. Me gustaría agrupar clientes por nombre de cliente solo si las regiones son las mismas mediante la creación de la columna ID de cliente modificado, que debe incluir una lista de identificadores de cliente únicos separados por una coma.

Por lo tanto, en este caso, Microsoft sería un cliente que me gustaría agrupar en 1 cliente porque tiene la misma región para todos los iDE de cliente, pero no me gustaría agrupar Amazon como 1 cliente porque uno está en Europa y uno está en los EE.UU. Por favor, comente si tiene alguna idea!

ID de clienteNombre del clienteProducto compradoRegiónID de cliente modificado (columna deseada)
124MicrosoftNubeNos124, 125, 126
124MicrosoftNubeNos124, 125, 126
125MicrosoftCentro de datosNos124, 125, 126
126MicrosoftCentro de datosNos124, 125, 126
223AmazonNubeNos223
224AmazonNubeEuropa224

Screen Shot 2020-05-21 at 9.52.20 AM.png

2 ACCEPTED SOLUTIONS
camargos88
Community Champion
Community Champion

No @jack421 ,

Prueba este:

Columna =
VAR _customer = CALCULATETABLE(DISTINCT('Table'[Customer ID]), FILTER('Table', 'Table'[Region] = EARLIER('Table'[Region]) && 'Table'[Customer Name] = EARLIER('Table'[Customer Name])))
RETURN CONCATENATEX(_customer, 'Table'[Id. de cliente], ",")
Capture.PNG


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



View solution in original post

ChrisMendoza
Resident Rockstar
Resident Rockstar

@jack421 -

Mida el intento de solución:

Measure Modified Customer ID = 
IF (
    ISFILTERED ( 'TableName'[Customer Name] ),
    CALCULATE (
        CONCATENATEX (
            DISTINCT ( TableName[Customer ID] ),
            TableName[Customer ID],
            ", "
        ),
        ALLEXCEPT ( 'TableName', 'TableName'[Customer Name], 'TableName'[Region] )
    ),
    BLANK ()
)

image.png






Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



View solution in original post

3 REPLIES 3
ChrisMendoza
Resident Rockstar
Resident Rockstar

@jack421 -

Mida el intento de solución:

Measure Modified Customer ID = 
IF (
    ISFILTERED ( 'TableName'[Customer Name] ),
    CALCULATE (
        CONCATENATEX (
            DISTINCT ( TableName[Customer ID] ),
            TableName[Customer ID],
            ", "
        ),
        ALLEXCEPT ( 'TableName', 'TableName'[Customer Name], 'TableName'[Region] )
    ),
    BLANK ()
)

image.png






Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



Greg_Deckler
Super User
Super User

Si entiendo correctamente, tal vez:

Column =
  CONCATENATEX(
    FILTER('Table',[Customer Name] = EARLIER([Customer Name]) && [Region] = EARLIER([Region]))
    [Customer ID],""
  )

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
camargos88
Community Champion
Community Champion

No @jack421 ,

Prueba este:

Columna =
VAR _customer = CALCULATETABLE(DISTINCT('Table'[Customer ID]), FILTER('Table', 'Table'[Region] = EARLIER('Table'[Region]) && 'Table'[Customer Name] = EARLIER('Table'[Customer Name])))
RETURN CONCATENATEX(_customer, 'Table'[Id. de cliente], ",")
Capture.PNG


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.