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
esuing
Helper I
Helper I

Medida DAX para recuperar fecha anterior con condiciones válidas

Escribí una medida que hace esto, pero se ejecuta demasiado lento para escalar a múltiples Prod No. He aquí un vistazo a los datos de un solo Prod No:

2020-08-31 11_18_58-Window.png Aquí está la fecha prev PIC:

Fecha de prev PIC ?
var currentdate - SELECTEDVALUE('Weights and Tests'[Pkup Date])
RETURN CALCULATE(MAX('Weights and Tests'[Pkup Date]),'Weights and Tests'[Pkup Date]<currentdate, ALL('Weights and Tests'[Sample No]), 'Weights and Tests'[PIC]>0)
Hace lo que se supone que debe hacer, que es recuperar la fecha anterior para este mismo Prod No donde hay un valor PIC. Sin embargo, esto se ejecuta MUY lentamente, así que sospecho que no he escrito esto de una manera eficiente. El "Días desde el último PIC" es sólo un dálogo entre las dos fechas. Si puedo obtener el número de días desde el último PIC para ese mismo Prod No, de una manera eficiente, eso también sería bueno. Ese es el objetivo final de todos modos.
Cualquier ayuda es muy apreciada!
Gracias.
Eric
1 ACCEPTED SOLUTION
esuing
Helper I
Helper I

Gracias por la ayuda. Ninguna de las soluciones realmente ayudó en el departamento de velocidad, pero pude limitar mis datos en algunas otras áreas y eso llevó el rendimiento a donde necesitaba que estuviera.

Gracias.

Eric

View solution in original post

3 REPLIES 3
esuing
Helper I
Helper I

Gracias por la ayuda. Ninguna de las soluciones realmente ayudó en el departamento de velocidad, pero pude limitar mis datos en algunas otras áreas y eso llevó el rendimiento a donde necesitaba que estuviera.

Gracias.

Eric

parry2k
Super User
Super User

@esuing aprovechar la función ALLEXCEPT

Date from Prev Date = 
VAR __currDate = SELECTEDVALUE ( Table[Date] )
VAR __prevDate = CACLULATE ( MAX ( Table[Date] ), ALLEXCEPT ( Table, Table[SampleNo] ), Table[Date] < __currDate )
RETURN
DATEDIFF ( __prevDate, __currDate, DAY )

Me gustaría elogios si mi solución ayudara. 👉 Si puedes pasar tiempo publicando la pregunta, también puedes hacer esfuerzos para dar a Kudos quien haya ayudado a resolver tu problema. ¡Es una muestra de agradecimiento!

Visítenos en https://perytus.com, su ventanilla única para proyectos/formación/consulta relacionadas con Power BI.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Greg_Deckler
Super User
Super User

@esuing - Tal vez intente:

Prev PIC Date =
var currentdate = SELECTEDVALUE('Weights and Tests'[Pkup Date])
VAR __Table = FILTER(ALL('Weights and Tests'),[PIC]>0)
VAR __Table1 = FILTER(__Table,[Pkup Date]<currentdate)
RETURN
MAXX(__Table1,[Pkup Date])

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.