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
Andybr
Frequent Visitor

Recuento y porcentaje nulo

Hola a todos

Soy un arquitecto de datos empresariales que es nuevo en PowerBI, estoy acostumbrado a las funciones SQL y Excel y escribir lo más simple es v. frustrante - cualquier ayuda es más apreciada.

Tengo una tabla, quiero contar el número de un valor de columna en particular, por ejemplo, 1234567 y luego cacular como un % del número total de tablas.

Ejemplo: La columna A tiene 5 instancias del valor 1234567 y hay 100 filas en la tabla, por lo que es un 5%

Usaría count, group by's y ctes en SQL Server, rascándome la cabeza aquí.

Salud

Andy R

5 REPLIES 5

Hola @Andybr ,

mira esto.

Measure = DIVIDE(COUNTROWS(FILTER('Table','Table'[Column] = 1234567)),COUNTROWS('Table'))

https://docs.microsoft.com/en-us/dax/divide-function-dax

https://docs.microsoft.com/en-us/dax/countrows-function-dax

https://docs.microsoft.com/en-us/dax/filter-function-dax

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


az38
Community Champion
Community Champion

@Andybr

puede usar la opción Porcentaje de total general en objetos visuales o crear una medida como

Measure = 
DIVIDE(
CALCULATE(COUNTROWS(Table), Table[Value] = "1234567"),
CALCULATE(COUNTROWS(Table), ALL(Table))
)

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Andybr
Frequent Visitor

Hola @az38 ,

Gracias por responder, que funciona, sólo problema que tengo es todas las filas en la tabla tienen el mismo % que el ejemplo que publiqué fue para un valor 1234567. En realidad, necesito el código para calcular % basado en el valor real que encuentra en cada fila. ¿Se puede hacer esto?

Andy

Hola @Andybr

probar esto

Measure = 
DIVIDE(
COUNTROWS(Table),
CALCULATE(COUNTROWS(Table), ALL(Table))
)
Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


@mwegener

que funciona muy bien gracias! 🙂

Andy

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.