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
Syndicate_Admin
Administrator
Administrator

Columna condicional simple en la fecha de hoy- Power Query

hola

Quiero agregar una columna con Power Query que muestre cualquier cosa antes de la fecha de hoy = "caducado" y no "en vivo"

Tengo este código, pero estoy recibiendo un error diciendo 'Expression.SyntaxError: Token Then expected' con el ^ justo debajo de la coma después de LocalNow()), a continuación.

= Table.AddColumn(#"Added Conditional Column", "Historic", each if [Agreement End Date] <= DateTime.Date(DateTime. LocalNow()), luego "Caducado" de lo contrario "En vivo")

Soy bastante nuevo en PowerBI y he probado sugerencias de preguntas relacionadas ya publicadas, pero no hay alegría: ¿cómo soluciono esto y / o hay una mejor manera de hacerlo?

Muchas gracias,

Andy

1 ACCEPTED SOLUTION
Syndicate_Admin
Administrator
Administrator

@Andy1927 , hay coma de adición , eliminado aquí

if [Agreement End Date] <= DateTime.Date(DateTime.LocalNow()) then "Expired" else "Live"

o

= Table.AddColumn(#"Added Conditional Column", "Historic", each if [Agreement End Date] <= DateTime.Date(DateTime. LocalNow()) then "Expired" else "Live")

View solution in original post

2 REPLIES 2
Syndicate_Admin
Administrator
Administrator

@Andy1927 , hay coma de adición , eliminado aquí

if [Agreement End Date] <= DateTime.Date(DateTime.LocalNow()) then "Expired" else "Live"

o

= Table.AddColumn(#"Added Conditional Column", "Historic", each if [Agreement End Date] <= DateTime.Date(DateTime. LocalNow()) then "Expired" else "Live")

¡Muchas gracias!

Tengo una solicitud adicional y no estoy seguro de si requiere un nuevo boleto separado? Anteriormente he utilizado el modelo de datos para crear 'bandas de fecha' por ejemplo, 0-6 mths, 7-12 mths, y así sucesivamente. Me gustaría hacer lo mismo en el editor de consultas utilizando la fecha de finalización del acuerdo- ¿es esto posible? Si es así, ¿hay algún ejemplo que pueda usar?

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.