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
Anonymous
Not applicable

Filtrado dinámico mediante segmentación de datos

Tengo una tabla con datos a continuación. Tengo una cortadora de fecha que filtra la fecha en esta tabla. En función del intervalo de fechas seleccionado, necesito filtrar mi tabla de tal manera que para cada empresa
y el tipo M trae la fecha más pequeña y más grande y la cantidad correspondiente y excluye otros registros de tipo M. Descansar todos los registros de tipo (X,Y) deben aparecer tal como están.
Básicamente 2 registros de tipo M para cada empresa y el primer registro debe tener la cantidad negativa. Quiero crear una tabla calculada basada en esto. ¿Es alcanzable en DAX?


Tabla de entrada

Grupo

Company_name

Tipo

Fecha

Cantidad

AA

A

X

28-02-2019

100

AA

A

Y

27-03-2019

200

AA

A

M

27-04-2019

300

AA

B

X

10-05-2019

400

AA

A

M

29-04-2019

500

AA

A

M

15-05-2019

500

AA

B

M

10-06-2019

600

AA

B

M

11-06-2019

700

AA

B

M

20-06-2019

800

Tabla de salida:

Grupo

Company_name

Tipo

Fecha

Cantidad

AA

A

X

28-02-2019

100

AA

A

Y

27-03-2019

200

AA

A

M

27-04-2019

-300

AA

B

X

10-05-2019

400

AA

A

M

15-05-2019

500

AA

B

M

10-06-2019

-600

AA

B

M

20-06-2019

800

¡Gracias!

1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hola @valentina14

podrías usar esta fórmula para crear una nueva tabla

New Table = 
FILTER('Table','Table'[Type]<>"M"||
('Table'[Type]="M"&&
                   ('Table'[Date]=CALCULATE(MIN('Table'[Date]),FILTER('Table','Table'[group]=EARLIER('Table'[group])&&'Table'[company_name]=EARLIER('Table'[company_name])&&'Table'[Type]="M"))||
                     'Table'[Date]=CALCULATE(MAX('Table'[Date]),FILTER('Table','Table'[group]=EARLIER('Table'[group])&&'Table'[company_name]=EARLIER('Table'[company_name])&&'Table'[Type]="M")))))

Resultado:

1.JPG

y aquí está el archivo pbix de muestra, por favor pruébelo.

saludos

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-lili6-msft
Community Support
Community Support

hola @valentina14

podrías usar esta fórmula para crear una nueva tabla

New Table = 
FILTER('Table','Table'[Type]<>"M"||
('Table'[Type]="M"&&
                   ('Table'[Date]=CALCULATE(MIN('Table'[Date]),FILTER('Table','Table'[group]=EARLIER('Table'[group])&&'Table'[company_name]=EARLIER('Table'[company_name])&&'Table'[Type]="M"))||
                     'Table'[Date]=CALCULATE(MAX('Table'[Date]),FILTER('Table','Table'[group]=EARLIER('Table'[group])&&'Table'[company_name]=EARLIER('Table'[company_name])&&'Table'[Type]="M")))))

Resultado:

1.JPG

y aquí está el archivo pbix de muestra, por favor pruébelo.

saludos

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak
Super User
Super User

@valentina14 , Añadir estas dos medidas en lugar de fecha y cantidad en visual

firstnonblank(Table[Date], blank())
firstnonblankvalue(Table[Date], max(Table[Amount]))

Y comprobar

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.