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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

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

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Gracias, funciona perfecto.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Top Solution Authors