Forum Discussion

AllanBerces's avatar
AllanBerces
Post Prodigy
1 year ago
Solved

Exclude Specific Category

Hi Good day,

Can anyone help me to edit my calculated column. I want to exclude one category in Table 1 (columnA)

note: (columnA) is available in Table 2

 

Earned =

CALCULATE (

    SUM ( 'Table 1'[Earned] ),

    FILTER (

        ALL ( 'Table 1'),

        'Table 1' [Week No.] = EARLIER ( 'Table 2'[Week No.] )

            && 'Table 1' [Year] = EARLIER ( 'Table 2' [Year])

            && 'Table 1' [Trade]  IN {"MECH", "CIVIL", "ELEC"}

    )

)

Thank you

  • Hi AllanBerces - you can create below logic to exclude the category to modify your Earned calculated column in Power BI and exclude a specific category . replace with your table and column names 

    Earned =
    CALCULATE (
    SUM ( 'Table 1'[Earned] ),
    FILTER (
    ALL ( 'Table 1' ),
    'Table 1'[Week No.] = EARLIER ( 'Table 2'[Week No.] ) &&
    'Table 1'[Year] = EARLIER ( 'Table 2'[Year] ) &&
    'Table 1'[Trade] IN { "MECH", "CIVIL", "ELEC" } &&
    'Table 1'[ColumnA] <> "CategoryToExclude" -- Add this condition to exclude the category
    )
    )

     

    Hope this works.

3 Replies

  • Hi AllanBerces - you can create below logic to exclude the category to modify your Earned calculated column in Power BI and exclude a specific category . replace with your table and column names 

    Earned =
    CALCULATE (
    SUM ( 'Table 1'[Earned] ),
    FILTER (
    ALL ( 'Table 1' ),
    'Table 1'[Week No.] = EARLIER ( 'Table 2'[Week No.] ) &&
    'Table 1'[Year] = EARLIER ( 'Table 2'[Year] ) &&
    'Table 1'[Trade] IN { "MECH", "CIVIL", "ELEC" } &&
    'Table 1'[ColumnA] <> "CategoryToExclude" -- Add this condition to exclude the category
    )
    )

     

    Hope this works.