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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Simple Count with critreria

Hi Guru,

 

I would like to create a measure to count the below names that were never flagged as 'X', result should be 2.

 

 

NameFlag
John 
Sam 
Jess 
Adam 
AdamX
Adam 
SamX
1 ACCEPTED SOLUTION
DOLEARY85
Resident Rockstar
Resident Rockstar

Hi,

 

you could create a measure that totals a distinct count of all names and calculates the number with an X then minus the names with x from the total:

 

Measure =
var Total = CALCULATE(DISTINCTCOUNT('Table'[Name]))
Var NamesWithX = CALCULATE(DISTINCTCOUNT('Table'[Name]),'Table'[Flag]="X")
return
Total-NamesWithX
 
If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @Anonymous ,

Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or if you are still confused about it, please feel free to let me know.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Tahreem24
Super User
Super User

@Anonymous Try this measure:

Measure = CALCULATE(COUNT(CountTable[Name]),FILTER(CountTable,CountTable[Flag]="X"))
Tahreem24_0-1700150304898.png

 

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard
DOLEARY85
Resident Rockstar
Resident Rockstar

Hi,

 

you could create a measure that totals a distinct count of all names and calculates the number with an X then minus the names with x from the total:

 

Measure =
var Total = CALCULATE(DISTINCTCOUNT('Table'[Name]))
Var NamesWithX = CALCULATE(DISTINCTCOUNT('Table'[Name]),'Table'[Flag]="X")
return
Total-NamesWithX
 
If I answered your question, please mark my post as solution, Appreciate your Kudos 👍
Anonymous
Not applicable

name and flag are seperate columns

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! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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