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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
bernate
Helper III
Helper III

Filter First Date by First Negative Value

Hello, I am trying to filter a table in Power Query to show the first month an item will have a negative balance. I want to identify the columns and mark them with a 1, the remove the rows in the Desired column that equal 0.

 

bernate_0-1707840594393.png

 

I did this with DAX by using the formula CALCULATE(FIRSTDATE('Buy Comp Balances - Open POs On'[Date]),'Buy Comp Balances - Open POs On'[Balance]<0).

 

I want to do this specifically in Power Query to decrease the size of my table and make the Item column have distinct values, so that the table would look like below:

bernate_1-1707840709459.png

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @bernate 

 

Please try the following steps:

 

First copy a table and operate on the copied table

 

1. Filter out all negative values

vxuxinyimsft_0-1707877795436.png

 

vxuxinyimsft_1-1707877825621.png

 

2. Filter by item as a group to find the minimum date for each item

vxuxinyimsft_2-1707877858239.png

 

vxuxinyimsft_3-1707877881682.png

 

vxuxinyimsft_4-1707877910182.png

 

3. Merge the two tables (Select two columns to match)

vxuxinyimsft_5-1707877990475.png

 

4. Expand the table

vxuxinyimsft_6-1707878024844.png

 

vxuxinyimsft_7-1707878041932.png

 

5. Click on the Close & Apply

vxuxinyimsft_9-1707878549864.png

 

6. Output

vxuxinyimsft_8-1707878442850.png

 

Best Regards,
Yulia Xu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @bernate 

 

Please try the following steps:

 

First copy a table and operate on the copied table

 

1. Filter out all negative values

vxuxinyimsft_0-1707877795436.png

 

vxuxinyimsft_1-1707877825621.png

 

2. Filter by item as a group to find the minimum date for each item

vxuxinyimsft_2-1707877858239.png

 

vxuxinyimsft_3-1707877881682.png

 

vxuxinyimsft_4-1707877910182.png

 

3. Merge the two tables (Select two columns to match)

vxuxinyimsft_5-1707877990475.png

 

4. Expand the table

vxuxinyimsft_6-1707878024844.png

 

vxuxinyimsft_7-1707878041932.png

 

5. Click on the Close & Apply

vxuxinyimsft_9-1707878549864.png

 

6. Output

vxuxinyimsft_8-1707878442850.png

 

Best Regards,
Yulia Xu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.