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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
stats
Frequent Visitor

Maximize sum of (n-combination) rows with constraint

I have a table with 3 columns: Product, Cost, Revenue.

There are 1000 rows (1000 distinct Products).

My budget equals B.

I want to filter 3 Products so that I maximize the Revenue sum for those 3 products, provided that the total Cost for those 3 Products are less than my budget B.

 

Can this be done in Power BI?

I would appreciate any kind of help.
Thank you in advance.
Best Regards.

2 REPLIES 2
daXtreme
Solution Sage
Solution Sage

@stats 

 

Such tasks are not suitable for effective DAX calculations (DAX is not a language for optimization problems). What you can do is this. Create a table where you'll have combinations of all 3 products. For each combination you should store their total cost and their total revenue as well Yes, I know, it'll be 1000^3 rows but PBI should be able to handle this, especially that there'll be a lot of repetition in each column (so the compression rate should be high). You can at least try... If you have such a table, it should then be easy to find the combination of interest.

@stats 

 

Well, actually it'll not be 1000^3 combinations but only 166 167 000 (1000 over 3). Well, this is something PQ can definitely handle without a problem! 🙂

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.