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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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