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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Syndicate_Admin
Administrator
Administrator

Columna calculada primera y última entrada de diferentes columnas

Hola
Necesito agregar una columna calculada a una tabla que se encuentra en el modelo tabulr, necesito una marca que compruebe cada trabajo si la primera entrada (basada en la fecha) del valor de la columna 'From Code' es la misma que
la última entrada de la columna 'A código' (basada en la fecha).
Necesito que el resultado parezca el siguiente. Job111 que se marcará como 'Sí' becaue el valor de 'From Code' = MA es el mismo que la última entrada de 'To Code'= MA.

2021-03-31_10-09-41.png

O incluso una medida, no tiene que ser calculada columna.

Gracias de antemano

1 ACCEPTED SOLUTION
Syndicate_Admin
Administrator
Administrator

No hay @sabd

Te refieres a una columna calculada dax, ¿verdad?

Vera_33_0-1617152997761.png

Flag = 
VAR CurJob = 'Table'[Job Number]
VAR T1 = FILTER('Table','Table'[Job Number]=CurJob)
VAR MinDate = MINX(T1,[Created DateTime Local])
VAR MaxDate = MAXX(T1,[Created DateTime Local])
VAR FromCode = MAXX(FILTER(T1,'Table'[Created DateTime Local]=MinDate),[From Code])
VAR ToCode = MAXX(FILTER(T1,'Table'[Created DateTime Local]=MaxDate),[To Code])
RETURN
IF(FromCode=ToCode,"Yes","No")

View solution in original post

3 REPLIES 3
Syndicate_Admin
Administrator
Administrator

Hola

Escriba esta fórmula de columna calculada

Flag = if(LOOKUPVALUE(Data[From Code],Data[Created DateTime Local],CALCULATE(min(Data[Created DateTime Local]),FILTER(Data,Data[Job Number]=EARLIER(Data[Job Number]))),Data[Job Number],Data[Job Number])=LOOKUPVALUE(Data[To Code],Data[Created DateTime Local],CALCULATE(max(Data[Created DateTime Local]),FILTER(Data,Data[Job Number]=EARLIER(Data[Job Number]))),Data[Job Number],Data[Job Number]),"Yes","No")

Espero que esto ayude.

Untitled.png

Syndicate_Admin
Administrator
Administrator

No hay @sabd

Te refieres a una columna calculada dax, ¿verdad?

Vera_33_0-1617152997761.png

Flag = 
VAR CurJob = 'Table'[Job Number]
VAR T1 = FILTER('Table','Table'[Job Number]=CurJob)
VAR MinDate = MINX(T1,[Created DateTime Local])
VAR MaxDate = MAXX(T1,[Created DateTime Local])
VAR FromCode = MAXX(FILTER(T1,'Table'[Created DateTime Local]=MinDate),[From Code])
VAR ToCode = MAXX(FILTER(T1,'Table'[Created DateTime Local]=MaxDate),[To Code])
RETURN
IF(FromCode=ToCode,"Yes","No")

Brriliant, Gracias @Vera_33, funcionó.

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.

Top Solution Authors
Top Kudoed Authors