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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
Anonymous
Not applicable

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
Anonymous
Not applicable

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