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

Workaround of Except Keyword

Currently i am using this measure to get the answer but it is taking too long to load. I have 60 million rows and it takes 20 sec to calculate using performance analyzer. Is there a way around of this EXCEPT keyword in dax so that I can reduce the calculation time?
test 2 =
 VAR Cal =
    CALCULATE (
        [Total Clients],
        EXCEPT (
            CALCULATETABLE (
                VALUES('TABLE'[ID]),
    ISBLANK('TABLE'[ID]) = FALSE(),
   TABLE[TYPE] IN {2,3},
            ),
            CALCULATETABLE (
                VALUES('TABLE'[ID]),
     ISBLANK('TABLE'[ID]) = FALSE(),
    TABLE[TYPE] IN  IN {1,4},
            )
        )
    )
    Return Cal
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous 

May you can refer to the following measure

test2 =
VAR a =
    FILTER ( ALLSELECTED ( 'TABLE'[ID] ), NOT ( ISBLANK ( 'TABLE'[ID] ) ) )
VAR b =
    CALCULATETABLE ( VALUES ( 'TABLE'[ID] ), 'TABLE'[TYPE] IN { 2, 3 }, a )
VAR c =
    CALCULATETABLE ( VALUES ( 'TABLE'[ID] ), 'TABLE'[TYPE] IN { 1, 4 }, a )
VAR d =
    FILTER ( b, NOT ( 'TABLE'[ID] IN c ) )
RETURN
    CALCULATE ( [Total Clients], d )

Best Regards!

Yolo Zhu

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

3 REPLIES 3
Anonymous
Not applicable

Thanks it worked, and much faster

Anonymous
Not applicable

Hi @Anonymous 

May you can refer to the following measure

test2 =
VAR a =
    FILTER ( ALLSELECTED ( 'TABLE'[ID] ), NOT ( ISBLANK ( 'TABLE'[ID] ) ) )
VAR b =
    CALCULATETABLE ( VALUES ( 'TABLE'[ID] ), 'TABLE'[TYPE] IN { 2, 3 }, a )
VAR c =
    CALCULATETABLE ( VALUES ( 'TABLE'[ID] ), 'TABLE'[TYPE] IN { 1, 4 }, a )
VAR d =
    FILTER ( b, NOT ( 'TABLE'[ID] IN c ) )
RETURN
    CALCULATE ( [Total Clients], d )

Best Regards!

Yolo Zhu

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

 

 

Anonymous
Not applicable

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.

Top Solution Authors