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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
adavid999
Helper V
Helper V

dax NOT in

Helllo, 

rather than writing out all this in example 1 (which gives correct result), how do I specify the NOT in (i want to count everything in table[sport] column except "09" and "99"

 

1. this gives right result

my measure = 
    CALCULATE(count(table[sport]), 
    table[sport] in {"01","02","03","04","05","06","07","08","10","11","12"},
    table[year] = "2017/18")

 do you know why these three examples below don't work?

2. 

test = 
    CALCULATE(count(table[sport]), 
    (table[sport]<> "09" &&
    table[sport]<> "99"),
    table[year] = "2017/18")

 3.

test2 = 
    CALCULATE(count(table[sport]), 
    not(table[sport] in {"09","99"}),
    table[year] = "2017/18")

 4.

test3 = 
    CALCULATE(count(table[sport]), 
    table[sport] <> "09",
    table[sport] <> "99",
    table[year] = "2017/18")

 Thanks

 

7 REPLIES 7
Samarth_18
Community Champion
Community Champion

Hi @adavid999 ,

 

Can you try this:-

test3 =
CALCULATE (
    COUNT ( table[sport] ),
    FILTER (
        table,
        ( table[sport] <> "09"
            || table[sport] <> "99" )
            && table[year] = "2017/18"
    )
)

 

Thanks,

Samarth

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

@Samarth_18 I tried but this didn't give me the result I was expecting

@adavid999 , Can you please share your PBIX after removing sensitive data and also the expected output?

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Greg_Deckler
Super User
Super User

@adavid999 You mean like NOT("something" IN 'Table'[Column])



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler hi there, yes, in this case i want to count everything that is not "09" and not "99" in table[sport] where availabe values are: 

 

"01","02","03","04","05","06","07","08","09","10","11","12","99"

 

 Just lookinf for a better way of writing it as my example 1 above, does the job. Also, I'm not 100% clear on why my other examples don't work. 

@adavid999 

maybe you can try this

test3 = 
    CALCULATE(count(table[sport]), 
    (table[sport] <> "09"||
    table[sport] <> "99" &&
    table[year] = "2017/18")




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




hi @ryan_mayu no this did not work. Your suggestion...

test3 = 
    CALCULATE(count(table[sport]), 
    (table[sport] <> "09"||
    table[sport] <> "99" &&
    table[year] = "2017/18")

 gives a different result to this (which gives the result I expect)

 

my measure = 
    CALCULATE(count(table[sport]), 
    table[sport] in {"01","02","03","04","05","06","07","08","10","11","12"},
    table[year] = "2017/18")

I want to count values that are not "09" or "99" from available values that are:

"01","02","03","04","05","06","07","08","09","10","11","12","99"

 grateful for any help with this.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.