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
wilson_smyth
Post Patron
Post Patron

Show most recent version/status for an order

I have a data set of orders. An order can be one of a few status.

It starts out in Draft.

It moves to either InProgress or rejected.

It can then move to appealed.

 

I need to display one row for each order, along with the most recent status. I have the created date of each row.



The below screenshot shows the data, and ther is a link to a powerbi pbix with the data loaded.
Capture.JPG
Id appreciate some expertise in figuring this out as im unsure where to start.
Thank you for any expertise provided.

 

https://1drv.ms/u/s!AgldA0VQfPV9hNFJRlvQ2Y_4EXQggg

 

 

 

 

1 ACCEPTED SOLUTION
HotChilli
Super User
Super User

That looks like a form of Slowly Changing Dimension.  Normally the current row would be marked with a column (and that usually comes from your source system)

If you don't have that mark from the source system, add a column like this

Column = VAR _maxDate = CALCULATE(MAX(FactTable[createdDate]), FILTER(FactTable, FactTable[orderid] = EARLIER(FactTable[OrderID])))
RETURN 
  IF (FactTable[createdDate] = _maxDate, "Y") 

Please test this, as I have just looked at it quickly.

Once you have this column, you can filter your table to return only rows where Column = "Y"

View solution in original post

2 REPLIES 2
HotChilli
Super User
Super User

That looks like a form of Slowly Changing Dimension.  Normally the current row would be marked with a column (and that usually comes from your source system)

If you don't have that mark from the source system, add a column like this

Column = VAR _maxDate = CALCULATE(MAX(FactTable[createdDate]), FILTER(FactTable, FactTable[orderid] = EARLIER(FactTable[OrderID])))
RETURN 
  IF (FactTable[createdDate] = _maxDate, "Y") 

Please test this, as I have just looked at it quickly.

Once you have this column, you can filter your table to return only rows where Column = "Y"

Thank you @HotChilli, this has worked. I never even considered looking at it like a slowly changing dimension.

Thank you for your expertise on this.

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.