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 September 15. Request your voucher.

Reply
Anonymous
Not applicable

Conversion of Excel formula to DAX

Hi,

 

I am struggling with a formula I need to convert from Excel to DAX. I have attached an image below of the sample data set, as well as the existing formula:

 

Sample dataset.png

 

=SUMPRODUCT(TEXT(TRIM(MID(SUBSTITUTE($B4&$G$4:$G$15;"%";REPT(" ";100));FIND($G$4:$G$15;SUBSTITUTE($B4&$G$4:$G$15;"%";REPT(" ";100)))+LEN($G$4:$G$15&"/");100));"0,000;0;0;\0")*($H$4:$H$15=B$19))/100

 

Basically, I have one table in PowerBI with a number of investor portfolios and their allocations towards a limited set of stocks, and another table with the total set of available stocks (with their region classification). 

 

What I need to do is to summarize each investor's allocation towards each region. All I need is the allocation in %, the amount in USD is irrelevant.

 

The problem for me, so far, seems to be that the "TEXT" function does not exist in DAX, and I have not been able to find a solution with alternative formulas. Please note, solving the problem using PowerQuery unfortunately is not an option in this case (for the purpose of the assignment, the solution needs to be purely in DAX, preferably as a measure rather than calculated column).

 

Thank you very much in advance. Will be happy to provide a sample workbook if preferred.

2 REPLIES 2
camargos88
Community Champion
Community Champion

Hi @Anonymous ,

 

Check this link: https://community.powerbi.com/t5/Desktop/Single-cell-stock-allocations/m-p/1054559#M493371



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Anonymous
Not applicable

Thanks Camargos,

 

Unfortunately, that solution relies on Power Query to do the calculations rather than a PowerPivot / DAX formula.

 

In this particular case that is unfortunately not an option.

 

Best,

Phil

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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