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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

NOT IN dax showing wrong counts

I am trying to write a DAX statement for NOT IN but i don't know the syntax for it. It's like:

 

CALCULATE(sum(C[T_S]),C[S] <> "C" || C[S] <> "V" || C[S] <> "D" || C[S] <> "C")
 
Eventhough, I mentioned not equals in the dax, the statement is showing me the total counts not the counts where there is <>.
 
Any help is much appreciated. 
1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi, @Anonymous ;

You could change to it.

q =
DIVIDE (
    CALCULATE (
        SUM ( C[T_S] ),
        FILTER ( C, NOT ( C[S] ) IN { "C", "V", "D", "C" } )
    ),
    SUM ( T_D[T_S] )
)

vyalanwumsft_0-1653380771341.png


Best Regards,
Community Support Team _ Yalan Wu
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

7 REPLIES 7
v-yalanwu-msft
Community Support
Community Support

Hi, @Anonymous ;

You could change to it.

q =
DIVIDE (
    CALCULATE (
        SUM ( C[T_S] ),
        FILTER ( C, NOT ( C[S] ) IN { "C", "V", "D", "C" } )
    ),
    SUM ( T_D[T_S] )
)

vyalanwumsft_0-1653380771341.png


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Ashish_Mathur
Super User
Super User

Hi,

Replace || with &&.  Remove the redundant condition - C[S]<>"C"


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

so, I wrote the denominator but the power bi is saying that "Operator or expression '( )' is not supported in this context."  

The italic, underline part is showing error as: "Operator or expression '( )' is not supported in this context."  

DIVIDE(CALCULATE(sum(C[T_S]), Filter(Cnot(C[S] in {"C" ,"V","D","C"},SUM(T_D[T_S]),0))))
Anonymous
Not applicable

So, I wrote the denominator but the power bi is saying that "Operator or expression '( )' is not supported in this context."  

The italic, underline part is showing error as: "Operator or expression '( )' is not supported in this context."  

DIVIDE(CALCULATE(sum(C[T_S]), Filter(C, not(C[S] in {"C" ,"V","D","C"},SUM(T_D[T_S]),0))))
Anonymous
Not applicable

I tried to put the formula but it says "too few arguments were passed to the divide function. thhe minimum argument count for the functions is 2". 

 

DIVIDE(CALCULATE(sum(C[T_S]), Filter(C, not( C[S] in {"C" ,"V","D","C"}))))
not sure, where i am wrong.

Hi @Anonymous,

You have missed out argument 2 in the DIVIDE function. You have only specified the numerator in the function.

DIVIDE(CALCULATE(sum(C[T_S]), Filter(CnotC[S] in {"C" ,"V","D","C"}))) , ____   )

 

If this solves your issue, please mark @amitchandak 's answer as the solution to help others too.

 

Kind regards,

 

Rohit

Appreciate your kudos! 😊

amitchandak
Super User
Super User

@Anonymous , Try like

CALCULATE(sum(C[T_S]), Filter(C, not( C[S] in {"C" ,V","D","C"} ) ) )

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.