Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago

COUNTX with FILTER

Dear Expertz,

 

I am trying power BI for first time , and I have requirement to use measure  to use  COUNTX with FILTER and  apply filters on multiple columns , and one of those filter is getting values from slicers( based on how many Items are being picked by user), This query isnot working for me. 

 

I have tried to return Value from same slicer to see whether it has any issues or not , but its working perfectly . However , not sure , why COUNTX and FILTER is not accepting the values .

 

I have tried sample code in DAX Studio and replaced COUNTX with EVALUATE to see if it returns anything , query ran successfuly and return no rows. 

 

Can any please help wherein I am going wrong?

 

Measure 1 = 


COUNTX(
    FILTER(
'Table1',
        'Table1'[OperationName] = "Start" &&
        'Table1'[OperationState] = "Failed" && 'Table1'[ErrorType] IN {CONCATENATEX ( VALUES ('ErrorTypes'[ErrorType] ) ,[ErrorType], ",")}
  ),

Table1[ID])---> Returning BLANK

 

Measure 2 = 

VAR A = CONCATENATEX ( VALUES ('ErrorTypes'[ErrorType] ) ,[ErrorType], ",")

RETURN 

A---> working fine

 

 

2 Replies

  • "IN"  expects a list of values.  You presented it with a single string where the values are glued together with commas.

     

    'Table1'[ErrorType] IN  VALUES ('ErrorTypes'[ErrorType] )

  • v-weiyan1-msft's avatar
    v-weiyan1-msft
    Icon for Community Support rankCommunity Support

    Hi Anonymous ,

     

    Have you solved your problem yet?
    If you still need help, can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data. We can better understand the problem and assist you.
    Looking forward to your reply.

     

    Best Regards,
    Yulia Yan

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.