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
Ramendra
Helper IV
Helper IV

calculate syntax

Hi  Team,

 

Can some one help me to  know for below syntax in Power BI measure

 

Count column A values if column B contains  value=XYZ and  if  column c contains value= ABC  or  PQR

1 ACCEPTED SOLUTION

@Ramendra 

Just add a NOT to that part:

Measure = CALCULATE(COUNT(Table1[ColA]), Table1[ColB] ="XYZ", NOT Table1[ColC] IN {"ABC", "PCR"} )

 

Please mark the question solved when done and consider giving kudos if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

View solution in original post

6 REPLIES 6
v-xuding-msft
Community Support
Community Support

Hi @Ramendra ,

 

Are the answer helpful for you? If yes, please kindly accept as solution. If you still need help, please share some sample data with us. Thanks.

 

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak
Super User
Super User

@Ramendra , Try like

calculate(count(Table[ColumnA]), filter(Table, Table[column B] ="XYZ" && Table[column B] in {"ABC","PQR"}))

AlB
Super User
Super User

Hi @Ramendra 

 

Measure =  CALCULATE(COUNT(Table1[ColA]), Table1[ColB] ="XYZ",  Table1[ColC] IN {"ABC", "PCR"} )

 

Please mark the question solved when done and consider giving kudos if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

 

SU18_powerbi_badge

Hi @AlB ,

 

Thanks for help.

Can you please also let me  know what  to  mention  instead of  "IN" for  Table1[ColC] IN {"ABC", "PCR"} ) if I want to  apply like below for  same syntax.

 

Table1[ColC] is not equal to "ABC" or  "PCR"

@Ramendra 

Just add a NOT to that part:

Measure = CALCULATE(COUNT(Table1[ColA]), Table1[ColB] ="XYZ", NOT Table1[ColC] IN {"ABC", "PCR"} )

 

Please mark the question solved when done and consider giving kudos if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

Hi @AlB ,

Thanks  for help.
Can you please  also let me know what to mention instead of  "IN" if I want to apply like below  for "Table1[ColC] IN {"ABC", "PCR"} )"

 Table1[ColC] does not equal to "ABC" or  "PCR"

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.