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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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
Top Kudoed Authors