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

COUNTIF con CONDITION en Power Query

Hola

Me preguntaba si hay una manera de hacer countif con condición en Power Query. Puedo obtener el resultado del deseo en DAX, pero necesito que esté en Power Query. Agradezco cualquier ayuda. Gracias

Tengo una tabla como la siguiente y el resultado del deseo es contar cuántos DaysLatePayment > 30 para cada CUENTA.

CuentaDaysLatePayment
A1
A1
A35
A20
A0
B2
B3
B32
B40
C5
C6
C11
C0
D3
D10
D1
D2

Resultado esperado

CuentaContar DíasPago Tardío > 30
A1
B2
C0
D0
4 REPLIES 4
Greg_Deckler
Super User
Super User

Prueba esto:

Dejar
Fuente: Table.FromRows(Json.Document(Binary.Decompress(Binary.Decompress(Binary.FromText("i45WcnR29g/1C1HSUXJJrCz2SSxJDUiszE3NK1GK1QASUNsbCMTeFMIwM4E8JyAgnCWcYIFkLQQ BKLSGcg0hbPM4CxDQzgTotAFbhCIZYgQNISzgIbHAgA", BinaryEncoding.Base64), Compression.Deflate)), let _t á ((texto de tipo) meta [Serialized.Text ? true]) en la tabla de tipos ["(blank)_t" "(blanco).1" - _t]),
"Tipo modificado" ? Tabla.TransformColumnTypes(Fuente, ? " (en blanco)", escriba text, .1", escriba text?), escriba text,),
"Encabezados promocionados" ? Table.PromoteHeaders("Changed Type", [PromoteAllScalars-true]),
"Changed Type1" á Table.TransformColumnTypes(''Encabezados promocionados'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
"Columna condicional agregada" - Table.AddColumn('Changed Type1", "Custom", cada uno si [DaysLatePayment] > 30 then 1 else 0),
"Filas agrupadas" - Tabla.Grupo('Columna condicional agregada'', ''CUENTA''',''Recuento'', cada Lista.Sum([Custom]', número de tipo')
En
"Filas agrupadas"

@ 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...
Anonymous
Not applicable

@Greg_Deckler astuto! nunca pensó que podría ser tan simple. ¡Gracias!

¡De vez en cuando puedo sacar un código M ingenioso! 🙂

@ 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...
parry2k
Super User
Super User

@ETL añadir una medida simple como esta

More than 30 days = CALCULATE ( COUNTROWS( Table ), Table[DaysLatePayment] > 30 ) 

Me gustaría elogiossi mi solución me ayudó.👉Si puedes pasar tiempo publicando la pregunta, también puedes hacer esfuerzos para darle a Kudos quien haya ayudado a resolver tu problema. ¡Es una muestra de agradecimiento!



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

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.