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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
jbeans
Frequent Visitor

Assign 1 to earliest Finish date based on conditions

Hi All 

Any help with the below would be much appreciated 

 

I have order table where an order Id can appear multiple times. I want to look at the earliest modified date and check if the rejection column is blank. If so assign a value of 1. If the user deselects that rejection reason, and the next earlies is row is blank I would like a value of 1 to still be assigned. However if there is a reason, 0 should be assigned. 

 

See my code below - 1 is getting applied to each row incorrectly

 

Thanks in advance 

 

 

Rejection Count = 
VAR FirstOrderDate = MINX(FILTER('lnd AWComponentLibraryApproval', 
    'lnd AWComponentLibraryApproval'[Approver_Role] = "LOC REVIEWER / APPROVER"), 'lnd AWComponentLibraryApproval'[Approval_finish_date])

RETURN
CALCULATE(
    1,
    FILTER(
        'lnd AWComponentLibraryApproval',
        'lnd AWComponentLibraryApproval'[Approval_finish_date] = FirstOrderDate &&
        ISBLANK('lnd AWComponentLibraryApproval'[Reason_for_rejection]) &&
        'lnd AWComponentLibraryApproval'[Approver_Role] = "LOC REVIEWER / APPROVER"
    )
)

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @jbeans,

You can try to use the following measure formula if it suitable for you requirements:

Rejection Count =
VAR FirstOrderDate =
    MINX (
        FILTER ( 'Table1', 'Table1'[Approver_Role] = "LOC REVIEWER / APPROVER" ),
        'Table1'[Approval_finish_date]
    )
RETURN
    IF (
        'Table1'[Approval_finish_date] = FirstOrderDate
            && 'Table1'[Approver_Role] = "LOC REVIEWER / APPROVER",
        IF (
            'Table1'[Reason_for_rejection] = BLANK ()
                || 'Table1'[Reason_for_rejection] = "",
            1,
            0
        )
    )

Regards,

Xiaoxin Sheng

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @jbeans,

You can try to use the following measure formula if it suitable for you requirements:

Rejection Count =
VAR FirstOrderDate =
    MINX (
        FILTER ( 'Table1', 'Table1'[Approver_Role] = "LOC REVIEWER / APPROVER" ),
        'Table1'[Approval_finish_date]
    )
RETURN
    IF (
        'Table1'[Approval_finish_date] = FirstOrderDate
            && 'Table1'[Approver_Role] = "LOC REVIEWER / APPROVER",
        IF (
            'Table1'[Reason_for_rejection] = BLANK ()
                || 'Table1'[Reason_for_rejection] = "",
            1,
            0
        )
    )

Regards,

Xiaoxin Sheng

Hi @Anonymous , thanks for your reply. It looks like that might work, however the intellisense will not let me select my finish date column on line 10, only measures. Am I missing something?

jbeans_0-1695723207029.png

 

Anonymous
Not applicable

HI @jbeans,

The 'finish' should be replaced to the variable that you define in above, the underline highlighted part should be changed to the table and field names that you mentioned to check with conditions.

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.