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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register 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
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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