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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Power BI Subquery: Returning values where SUM greater than 1

I have a dataset which looks like the following:

 

Capture1.PNG

 

I want to write a query that returns sales_week, product, username and the SUM of qty only where the SUM is greater than 1.

 

I would write this in SQL using a subquery as follows:

 

SELECT tbl1.* FROM
  (SELECT sales_week, username, product, SUM(qty) AS 'total_qty'
  FROM sales_data
  GROUP BY sales_week, username, product) AS tbl1
WHERE tbl1.total_qty > 1

Which would result in the following:

 

Capture2.PNG

 

Can someone please help me to generate the same result in Power BI?

 

 

 

1 ACCEPTED SOLUTION
evandrocunico
Resolver III
Resolver III

Hi @Anonymous 

 

try this: 

modeling -> create a newtable

New_table =
FILTER(
SUMMARIZE( Sales_data, 'Sales_data'[sales_week], 'Sales_data'[username], 'Sales_data'[product], "Total qty", sum('Sales_data'[qty])),
[total_qty] > 1)

 

 

View solution in original post

2 REPLIES 2
evandrocunico
Resolver III
Resolver III

Hi @Anonymous 

 

try this: 

modeling -> create a newtable

New_table =
FILTER(
SUMMARIZE( Sales_data, 'Sales_data'[sales_week], 'Sales_data'[username], 'Sales_data'[product], "Total qty", sum('Sales_data'[qty])),
[total_qty] > 1)

 

 

Anonymous
Not applicable

Thank you Smiley Very Happy

 

Your provided solution worked like a charm!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.