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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
paguy215
Helper III
Helper III

Column to indicate if same invoice has an earlier date

I have a data set in which I have a series of invioces with various criteria.   But i'm trying to account for an issue in which multiple invoices are created for the same account.  This would only occur if another criteria is met, in this case a flag is indicated...so I can't use Group By in Power Query

 

Can I create  column in the table that would identify if that same accountID has another row with an earlier invoice date?

1 ACCEPTED SOLUTION
v-yilong-msft
Community Support
Community Support

Hi @paguy215 ,

I create a table as you mentioned.

vyilongmsft_0-1711000483785.png

Then I create a new calculated column.

Column =
VAR _minDate =
    CALCULATE (
        MIN ( 'Table'[Date] ),
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[accountID] = EARLIER ( 'Table'[accountID] )
        )
    )
VAR _maxDate =
    MAXX (
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[accountID] = EARLIER ( 'Table'[accountID] )
        ),
        'Table'[Date]
    )
RETURN
    IF ( 'Table'[Date] = _minDate && 'Table'[Date] <> _maxDate, 1 )

Finally you will get the date you want.

vyilongmsft_1-1711000646911.png

 

 

 

Best Regards

Yilong Zhou

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

2 REPLIES 2
v-yilong-msft
Community Support
Community Support

Hi @paguy215 ,

I create a table as you mentioned.

vyilongmsft_0-1711000483785.png

Then I create a new calculated column.

Column =
VAR _minDate =
    CALCULATE (
        MIN ( 'Table'[Date] ),
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[accountID] = EARLIER ( 'Table'[accountID] )
        )
    )
VAR _maxDate =
    MAXX (
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[accountID] = EARLIER ( 'Table'[accountID] )
        ),
        'Table'[Date]
    )
RETURN
    IF ( 'Table'[Date] = _minDate && 'Table'[Date] <> _maxDate, 1 )

Finally you will get the date you want.

vyilongmsft_1-1711000646911.png

 

 

 

Best Regards

Yilong Zhou

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

lbendlin
Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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