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

Compare Condition of an article, from one day vs the previous day with data

Hello, good afternoon, I need to generate an input condition of a code or article when it enters a certain condition.

I have a stock evolution file, with days not necessarily consecutive, I update it random days, within the condition of the article is the "zone" that occupies according to its actual stock level and its target stock level. This area can be I, II, III, IV, V or VI, in Roman numbers according to this target Stock/Stock relationship. I would like to know in a table that codes went from any area other than I, to zone I, comparing the day where I stand vs the previous one with data and generate a category "I go into zone I".

This is my data table, with articles and zone x article

FedeSalvemini_0-1603234700976.png

Here would be an example of a code that I would like to get into the category:

day 21/8 moves to Zone I.

FedeSalvemini_1-1603234774894.png

I already have the measure "last day" q relates the reference day to the previous one that has data. serious condition. if the zone in "last day"<>"I" and the zone "date down" ""I", "I enter zone 1

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , You can have two new columns like

 

last Fecha = maxx(filter(Table, [codigo] =earlier([codigo]) && [Fecha] < earlier([Fecha]) ),[Fecha])
last Mo_zone = maxx(filter(Table, [codigo] =earlier([codigo]) && [Fecha] = [last Fecha] ),[Mo_zone])

 

For measure approach refer https://medium.com/@amitchandak.1978/power-bi-day-intelligence-questions-time-intelligence-5-5-5c3243d1f9

 

Please provide your feedback comments and advice for new videos
Tutorial Series Dax Vs SQL Direct Query PBI Tips
Appreciate your Kudos.

View solution in original post

2 REPLIES 2
v-kelly-msft
Community Support
Community Support

Hi @Anonymous ,

 

Is your issue solved now?

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

amitchandak
Super User
Super User

@Anonymous , You can have two new columns like

 

last Fecha = maxx(filter(Table, [codigo] =earlier([codigo]) && [Fecha] < earlier([Fecha]) ),[Fecha])
last Mo_zone = maxx(filter(Table, [codigo] =earlier([codigo]) && [Fecha] = [last Fecha] ),[Mo_zone])

 

For measure approach refer https://medium.com/@amitchandak.1978/power-bi-day-intelligence-questions-time-intelligence-5-5-5c3243d1f9

 

Please provide your feedback comments and advice for new videos
Tutorial Series Dax Vs SQL Direct Query PBI Tips
Appreciate your Kudos.

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.