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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
BotBot1
Helper III
Helper III

Count of Companies that have been rejected and not resubmitted

Hi all,

 

I am trying to get a measure that will be a distinct count of company ids where their latest action contains the string "reject", is greater than 2 weeks old, and excludes companies that have had newer actions that include either strings "accept" or "Submitted". Please see below for examples:

company_id 1335 would be in the count, as the have rejections, not had a newer "accept"/"Submitted" action, and is older than 2 weeks ago.

BotBot1_0-1687951846609.png


company_id 1085 would not be included, as they had a rejection but have had subsequent submittals/acceptances.

BotBot1_2-1687952030506.png


Here is my attempted DAX:

Rejections Sent Not Submitted (2W) 2 = 

VAR TwoWeeksAgo = TODAY() - 14

VAR LatestReject = CALCULATE(MAX(vw_FT_Company_Registration_BI[RegistrationLog_DateCreated]), 
                    CONTAINSSTRING(vw_FT_Company_Registration_BI[RegistrationLog_Action], "reject"))

VAR LatestAcceptOrSubmit = CALCULATE(MAX(vw_FT_Company_Registration_BI[RegistrationLog_DateCreated]), 
                            CONTAINSSTRING(vw_FT_Company_Registration_BI[RegistrationLog_Action], "accept") ||
                            CONTAINSSTRING(vw_FT_Company_Registration_BI[RegistrationLog_Action], "Submitted"))

RETURN

CALCULATE(DISTINCTCOUNT(vw_FT_Company_Registration_BI[company_id]), 
            vw_FT_Company_Registration_BI[RegistrationLog_DateCreated] <= TwoWeeksAgo,
                LatestReject > LatestAcceptOrSubmit)
 
Please let me know if any further explanation is needed, thank you!
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @BotBot1 ,

 

Please try this measure:

Rejections Sent Not Submitted (2W) 2 = 
VAR TwoWeeksAgo = TODAY() - 14
VAR RejectRows =
    FILTER (
        'vw_FT_Company_Registration_BI',
        SEARCH("reject", 'vw_FT_Company_Registration_BI'[RegistrationLog_Action], 1, 0) > 0
            && 'vw_FT_Company_Registration_BI'[RegistrationLog_DateCreated] < TwoWeeksAgo
    )
VAR AcceptSubmitRows =
    FILTER (
        'vw_FT_Company_Registration_BI',
        (
            SEARCH("accept", 'vw_FT_Company_Registration_BI'[RegistrationLog_Action], 1, 0) > 0
                || SEARCH("Submitted", 'vw_FT_Company_Registration_BI'[RegistrationLog_Action], 1, 0) > 0
        )
    )
RETURN
    CALCULATE (
        DISTINCTCOUNT ( 'vw_FT_Company_Registration_BI'[company_id] ),
        FILTER (
            RejectRows,
            NOT (
                CALCULATE (
                    COUNTROWS ( 'vw_FT_Company_Registration_BI' ),
                    FILTER (
                        AcceptSubmitRows,
                        'vw_FT_Company_Registration_BI'[company_id] = EARLIER ( 'vw_FT_Company_Registration_BI'[company_id] )
                            && 'vw_FT_Company_Registration_BI'[RegistrationLog_DateCreated] > EARLIER ( 'vw_FT_Company_Registration_BI'[RegistrationLog_DateCreated] )
                    )
                ) > 0
            )
        )
    )

vcgaomsft_0-1688092903962.png

vcgaomsft_1-1688092918634.png

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @BotBot1 ,

 

Please try this measure:

Rejections Sent Not Submitted (2W) 2 = 
VAR TwoWeeksAgo = TODAY() - 14
VAR RejectRows =
    FILTER (
        'vw_FT_Company_Registration_BI',
        SEARCH("reject", 'vw_FT_Company_Registration_BI'[RegistrationLog_Action], 1, 0) > 0
            && 'vw_FT_Company_Registration_BI'[RegistrationLog_DateCreated] < TwoWeeksAgo
    )
VAR AcceptSubmitRows =
    FILTER (
        'vw_FT_Company_Registration_BI',
        (
            SEARCH("accept", 'vw_FT_Company_Registration_BI'[RegistrationLog_Action], 1, 0) > 0
                || SEARCH("Submitted", 'vw_FT_Company_Registration_BI'[RegistrationLog_Action], 1, 0) > 0
        )
    )
RETURN
    CALCULATE (
        DISTINCTCOUNT ( 'vw_FT_Company_Registration_BI'[company_id] ),
        FILTER (
            RejectRows,
            NOT (
                CALCULATE (
                    COUNTROWS ( 'vw_FT_Company_Registration_BI' ),
                    FILTER (
                        AcceptSubmitRows,
                        'vw_FT_Company_Registration_BI'[company_id] = EARLIER ( 'vw_FT_Company_Registration_BI'[company_id] )
                            && 'vw_FT_Company_Registration_BI'[RegistrationLog_DateCreated] > EARLIER ( 'vw_FT_Company_Registration_BI'[RegistrationLog_DateCreated] )
                    )
                ) > 0
            )
        )
    )

vcgaomsft_0-1688092903962.png

vcgaomsft_1-1688092918634.png

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

Amazing, thank you so much!

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.