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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
v-xinruzhu-msft
Community Support
Community Support

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

v-xinruzhu-msft
Community Support
Community Support

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.