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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
michaelshparber
Advocate V
Advocate V

Nested SQL in a Measure

Hello friends,

I need to calculate monthly sales amount for each customer ONLY IF the customer has a sales transaction of $500 and above.

If there is such a transaction, then I need to summ ALL of that customer's sales in that month.

It's like first selecting customers/month that have this transactions

and then selecting from the sales table joining with the previous results.

I was able to solve it using a calculated column and a measure.

But I am looking for an elegant all-in-one measure solution.

Thank you

Michael

1 ACCEPTED SOLUTION
jthomson
Solution Sage
Solution Sage

So if we have this data:

 

test440.PNG

 

We'd want bob to be 1500 and dave to be 2000 as they have individual line(s) of at least 500, but jim would be 0 as he doesn't? In that case, this works for me:

 

if(max('Table'[salevalue])>=500,sum('Table'[salevalue]),blank())

View solution in original post

2 REPLIES 2
jthomson
Solution Sage
Solution Sage

So if we have this data:

 

test440.PNG

 

We'd want bob to be 1500 and dave to be 2000 as they have individual line(s) of at least 500, but jim would be 0 as he doesn't? In that case, this works for me:

 

if(max('Table'[salevalue])>=500,sum('Table'[salevalue]),blank())

@jthomson 

I think the solution can't be more simple than yours!

Thank you!

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.