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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
SophRow
Resolver II
Resolver II

Create measure to count rows based on value in one column that is filtered by another column

Hi,

 

I want to create a measure that counts the number of rows in a table that contains a value from one column, that is filtered by values from another column.

 

SophRow_0-1673733823641.png

 

So, I'd like to know How many Event "A" there are that have Criteria of "A" or "C" - so in this example it would = 2. 

 

Thanks!

Soph

2 ACCEPTED SOLUTIONS
Nathaniel_C
Super User
Super User

Hi @SophRow ,

if [#"Criteria "] = "A" and [#"Type of Event"] = "A" or [#"Criteria "] = "C" and [#"Type of Event"] = "A" then 1 else 0

 

Nathaniel_C_0-1673735839649.png


Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

Thanks Nathaniel!

 

It's almost working - just this weird error with then and else:

 

SophRow_0-1673737272115.png

Any ideas? I added "#" before "Seriousness Criteria" but that throws up an "invalid identifier" error

View solution in original post

6 REPLIES 6
Nathaniel_C
Super User
Super User

Hi @SophRow ,

if [#"Criteria "] = "A" and [#"Type of Event"] = "A" or [#"Criteria "] = "C" and [#"Type of Event"] = "A" then 1 else 0

 

Nathaniel_C_0-1673735839649.png


Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thanks Nathaniel!

 

It's almost working - just this weird error with then and else:

 

SophRow_0-1673737272115.png

Any ideas? I added "#" before "Seriousness Criteria" but that throws up an "invalid identifier" error

Ignore - it's working now!

Hi @SophRow ,
IF should be lower case. if





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




hi @SophRow ,

You can create a column in Power Query and then sum that column in a measure.

Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Nathaniel_C_1-1673736366776.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.