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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
sabry_303
Frequent Visitor

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
Super User
Super User

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
v-binbinyu-msft
Community Support
Community Support

Hi @sabry_303 ,

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

@sabry_303 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
Super User
Super User

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 👍
sabry_303
Frequent Visitor

name and flag are seperate columns

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors