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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
dieguil
Frequent Visitor

contar valores distintos de una columna combinada dax

Hola a todos, necesito de vuestra ayuda para contar los valores distintos que surgen de la combinación de dos campos. 
estuve dando vueltas con la siguiente medida, pero no logro que funcione:

Cant_Cat_N2 =
CALCULATE(DISTINCTCOUNT(SELECTCOLUMNS(Clientes,
"Cliente_Grupo",
Venta[Nro_Client] & Venta[Grupo_Articulo])
))

Me ayudan?

5 REPLIES 5
dieguil
Frequent Visitor

Gracias @Anonymous y @bhanu_gautam 
Las medidas funcionan, pero no me dan el resultado esperado. 

Dos maneras de calcular lo que necesito: 
1. La que me propusieron me da un total de 904.766

2. Si armo una columnaconcatenando los campos Nro_Cliente +Grupo_Articulo
y luego aplico la siguiente medida:

Cantidad_Cliente_Grupo = CALCULATE(
                                                 DISTINCTCOUNT(
                                                          Venta[Clave_Cliente_Grupo]))
El resultado es 663.064. que es el resultado esperado.
Esta opción es la que quiero evitar ya que la tabla de venta tiene 6 M de registros, y la el campo concatenado consume mucha memoria.

Se les ocurre como pueden modificar vuestra opción 
                                   
Anonymous
Not applicable

Hi @dieguil ,

 

Thank you for your feedback.

 

You can use the Summarize function in DAX to create a summarized table directly within your measure, avoiding the need to create a new concatenated column in your data table.

 

This approach helps to optimize memory usage and improve performance.

 

Here's an example of how you can achieve this:

Cantidad_Cliente_Grupo = 
CALCULATE(
    COUNTROWS(
        SUMMARIZE(
            Sale,
            Sale[Nro_Client],
            Sale[Grupo_Articulo]
        )
    )
)

Best regards,

Joyce

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

dieguil
Frequent Visitor

@bhanu_gautam muchas gracias por tu aporte, pero la función termina con el siguiente error:

La función DISTINCTCOUNT solo acepta una referencia de columna como argumento.

Anonymous
Not applicable

Hi @dieguil , hello bhanu_gautam, thank you for your prompt reply!

Please try the following measure to check if it meets your requirements:

 

Count_Combinations_Per_Client = 
CALCULATE(
    COUNTROWS(
        SUMMARIZE(
            RELATEDTABLE(Sale),
            Sale[Nro_Client],
            Sale[Grupo_Articulo]
        )
    )
)

 Result for your reference:

vyajiewanmsft_0-1729847129942.png

Feel free to let me know if you need any further adjustments or additional help!

 

Best regards,

Joyce

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

bhanu_gautam
Super User
Super User

@dieguil , Try using 

 

Cant_Cat_N2 =
CALCULATE(
DISTINCTCOUNT(
SUMMARIZE(
Clientes,
Venta[Nro_Client],
Venta[Grupo_Articulo],
"Cliente_Grupo", Venta[Nro_Client] & Venta[Grupo_Articulo]
)
)
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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