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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
Anonymous
Not applicable

base de columna de incremento automático en condiciones

Hola a todos

Necesito crear una nueva columna (Dax o PowerQuery) basada en otra columna. Este es mi escenario

Country date Test Indice
China 22/01/2020 0:00:00 548 2179
China 23/01/2020 0:00:00 643 2180
China 24/01/2020 0:00:00 920 2181
Spain 22/01/2020 0:00:00 0 9769
Spain 23/01/2020 0:00:00 0 9770
Spain 24/01/2020 0:00:00 0 9771
US 22/01/2020 0:00:00 1 11089
US 23/01/2020 0:00:00 1 11090
US 24/01/2020 0:00:00 2 11091

Y esto es lo que me gustaría usar obatin:

Country date Test Indice WhatIWantIs
China 22/01/2020 0:00:00 548 2179 1
China 23/01/2020 0:00:00 643 2180 2
China 24/01/2020 0:00:00 920 2181 3
Spain 22/01/2020 0:00:00 0 9769 0
Spain 23/01/2020 0:00:00 0 9770 0
Spain 24/01/2020 0:00:00 1 9771 1
US 22/01/2020 0:00:00 1 11089 1
US 23/01/2020 0:00:00 1 11090 2
US 24/01/2020 0:00:00 2 11091 3

Si la prueba de columna es 0 , la nueva columna tiene que ser 0 pero si la prueba es > 0 nueva columna tiene que incrementar +1 también teniendo en cuenta el país y la fecha de las columnas para garantizar la integridad de los datos.

Gracias

2 REPLIES 2
amitchandak
Super User
Super User

@cromero

Por favor, pruebe una nueva columna como

What you want = COUNTX(FILTER(data,[Country]=EARLIER([Country]) && [date]<=EARLIER([date]) && [Test]>0),[date] )+0

El archivo se adjunta después de la firma

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Anonymous
Not applicable

Gracias, funciona perfecto.

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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

Top Solution Authors