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
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
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.