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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register 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
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors