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
ConnorH
Employee
Employee

Filtering a table to a new table

I am not really sure how to go about an issue I came across. 

 

I have a table called status containing columns such as:

Project IDStatus ExtractStatus Change DateCreated date
135683.07/15/207/10/20
135684.07/16/207/10/20
155981.07/18/207/16/20
155982.07/20/207/16/20
135683.07/20/207/10/20
137724.07/30/207/10/20

 

I am trying to filter this table into another table or create another column in this table which will allow me to filter out blanks. The project may have the same status twice but my goal is to have a project with no duplicate status and take the most recent date for the status changed date.

 

So a a custom column would look like this. Where the first row with the new column is left blank because there is a more recent date for that status with that project ID.

 

Project IDStatus ExtractStatus Change DateCreated dateEdit Status Change Date
135683.07/15/207/10/20 
135684.07/16/207/10/207/16/20
155981.07/18/207/16/207/18/20
155982.07/20/207/16/207/20/20
135683.07/20/207/10/207/20/20

 

My other idea fold be to somehow pull this data into a new table with a filter but I don't now how I would do that.

1 ACCEPTED SOLUTION
W_G_Ryan
Helper I
Helper I

I'm not totally sure I follow the goal, but if you're familiar with Lag and Lead in SQL, is the idea that if there's a Lead value on the date, to leave the column blank?  If so I think this is what you're looking for.  Still new myself but I used this a while ago and I think this will work if I follow ask correctly:

https://community.powerbi.com/t5/Desktop/Lead-and-Lag-in-DAX/td-p/649162

View solution in original post

2 REPLIES 2
W_G_Ryan
Helper I
Helper I

I'm not totally sure I follow the goal, but if you're familiar with Lag and Lead in SQL, is the idea that if there's a Lead value on the date, to leave the column blank?  If so I think this is what you're looking for.  Still new myself but I used this a while ago and I think this will work if I follow ask correctly:

https://community.powerbi.com/t5/Desktop/Lead-and-Lag-in-DAX/td-p/649162

I was able to pull the Latest date where ProjectID=ProjectID and Status=Status. I still do not know how to set this equation up to only keep one value per status per project ID.

 

ProjectIDStatus ExtractModifiedLast Status Date (New column)
346312.16/1/20 
346312.16/4/206/4/20
346314.06/20/206/20/20

 

"Last status date =
var _ProjectID = 'Status'[ProjectID]
var _Status = 'Status'[Status Extract]
Var _StatusDate = 'Status'[Modified]
var _LaterDate = MAXX(FILTER('Status','Status'[ProjectID] = _ProjectID && 'Status'[Status Extract] = _Status), 'Status'[Modified])

Return _LaterDate"
 
 
this equation will make the table like this:
ProjectIDStatus ExtractModifiedLast Status Date (New column)
346312.16/1/206/4/20
346312.16/4/206/4/20
346314.06/20/206/20/20

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.

Top Solution Authors