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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Matching order ID from previous day to see yesterday's order value

Hi!

 

I am having trouble with writing the formula for this calculated column.

 

I have one big table that lists orders coming in by day. An order can remain "open" until the truck has finally shipped with all of the necessary materials that a consumer ordered. It is possible that an order's value decreases day over day while it is open if we are unable to fulfill all of the consumer's demand and we cut some materials off of the order.

 

Is there a way that I can input a calculated column that tells me the value of the order from yesterday by matching the specific order ID?

 

Thank you very much in advance for your help!!

1 ACCEPTED SOLUTION

One of two is working

Previous value = Minx(filter(table,table[DATE]=earlier(table[DATE])-1 && table[ORDER ID]=earlier(table[ORDER ID])),table[Todays Value])
Previous value = Minx(filter(table,table[DATE]-1=earlier(table[DATE]) && table[ORDER ID]=earlier(table[ORDER ID])),table[Todays Value])

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

You can create a column with diff from today and age 1 means open from yesterday

 

datediff = datediff(order[date],today(),day)

 

Can you share sample data and sample output.

Anonymous
Not applicable

Thank you for your quick response!

 

Unfortunately, I cannot share any data as it is highly confidential. I will try to make up an example table.

 

DATEORDER IDToday's ValueYesterday's Value
1/1/2020123$500-
1/1/2020456$600-
1/1/2020789$700-
1/2/2020123$450$500
1/2/2020456$600$600
1/2/2020789$675$700
1/3/2020123$450$450
1/3/2020456$600$600
1/3/2020789$675

$675

 

The "Yesterday's Value" column is what I am trying to compute.

 

Thank you!!

One of two is working

Previous value = Minx(filter(table,table[DATE]=earlier(table[DATE])-1 && table[ORDER ID]=earlier(table[ORDER ID])),table[Todays Value])
Previous value = Minx(filter(table,table[DATE]-1=earlier(table[DATE]) && table[ORDER ID]=earlier(table[ORDER ID])),table[Todays Value])

Anonymous
Not applicable

Seem to me as it is working! Thank you very much for your help!!!

Helpful resources

Announcements
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.