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
Anonymous
Not applicable

GroupBy and Having Clause

Hi,

 

How do I use the GroupBy and Having clause in my dataset? I have the following table:

  

[TableA]

Name    Completed  TaskNumber

Opp1     No               1

Opp1     No               2

Opp1     No               3

Opp1     No               4

Opp2     No               1

Opp2     No               2

Opp2     No               3

 

In SQL the statement would be this:

 

Select Name from [TableA]
GroupBy Name
Having Count(TaskNumber) > 3

 

 

 

Thanks

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thanks Matt but this didn't really do what I needed.

In the end I did a Group By via the Query Editor and did a slice visualisation against the count.

 

Cheers

View solution in original post

3 REPLIES 3

Power BI doesn't work this way (I guess you know that).  Are you trying to see these records in a visual, such as a table?  If so, you need to write a measure that returns a non blank result when it passes your having test, and then place that in a visual along with the columns you want to see. A measure could be

 

display = if(countrows(tableA))>=3,countrows(tableA))

 

put name and the measure in a visual



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
Anonymous
Not applicable

Thanks Matt but this didn't really do what I needed.

In the end I did a Group By via the Query Editor and did a slice visualisation against the count.

 

Cheers

What If I want a sum of the subtotals that meet those rules?  Currenly I get a total of all rows combined.  

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.