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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
keith515
Frequent Visitor

Weightage based on unique value

Hi all, any advice in relation to the following problem would be greatly appreciated.

 

Background to problem:

 

I have a data table with portfolio ID column which there will be several customers under same portfolio ID.  In my previous excel working I am using the nominal amount from each customer ID divided by the sum up the total nominal of each PFID for the weightage. How do I build a formula column in Power BI table that return the weightage amount based on each unique customer ID? 

 

 

Example as below with the calculation I did in Excel:

PortfolioCustomer IDNominal amountWeightage
PFID551600,0000.705882
PFID602200,0000.117647
PFID603100,0000.058824
PFID554100,0000.117647
PFID605500,0000.294118
PFID556150,0000.176471
PFID607300,0000.176471
PFID568300,0000.75
PFID659250,0000.263158
PFID561050,0000.125
PFID5711200,0000.285714
PFID6012100,0000.058824
PFID561350,0000.125
PFID5714200,0000.285714
PFID6515700,0000.736842
PFID5716300,0000.428571
PFID6017500,0000.294118



1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

It is for creating a calculated column.

 

Jihwan_Kim_0-1734324460942.png

 

 

Weightage CC = 
VAR _portfolio = Data[Portfolio]
RETURN
    DIVIDE (
        Data[Nominal amount],
        SUMX ( FILTER ( Data, Data[Portfolio] = _portfolio ), Data[Nominal amount] )
    )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

View solution in original post

4 REPLIES 4
Poojara_D12
Super User
Super User

Hi @keith515 

 

  • Go to the table in Power BI where your data resides.
  • Click on the Modeling tab and select New Column.
  • Use the following DAX formula:

 

Weightage = 
VAR PortfolioID = [Portfolio] 
VAR TotalNominalForPortfolio = 
    CALCULATE(
        SUM('YourTable'[Nominal amount]),
        ALLEXCEPT('YourTable', 'YourTable'[Portfolio])
    )
RETURN 
    DIVIDE([Nominal amount], TotalNominalForPortfolio, 0)
​

 

  • Example Output:
    Poojara_D12_0-1734691136345.png
  • Ensure the "Portfolio" and "Nominal amount" columns are correctly formatted and named.

Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Poojara
Data Analyst | MSBI Developer | Power BI Consultant
Consider Subscribing my YouTube for Beginners/Advance Concepts: https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS 

 

Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a "Kudos"

Kind Regards,
Poojara - Proud to be a Super User
Data Analyst | MSBI Developer | Power BI Consultant
Consider Subscribing my YouTube for Beginners/Advance Concepts: https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS
v-aatheeque
Community Support
Community Support

Hi @keith515 

We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet.
In case if you have any resolution please do share that same with the community as it can be helpful to others.
Otherwise, will respond back with the more details and we will try to help.

Kedar_Pande
Super User
Super User

@keith515 

Calculated column:

Weightage = 
'Table'[Nominal amount] /
CALCULATE(
SUM('Table'[Nominal amount]),
ALLEXCEPT('Table', 'Table'[Portfolio])
)

💌 If this helped, a Kudos 👍 or Solution mark would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn

Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

It is for creating a calculated column.

 

Jihwan_Kim_0-1734324460942.png

 

 

Weightage CC = 
VAR _portfolio = Data[Portfolio]
RETURN
    DIVIDE (
        Data[Nominal amount],
        SUMX ( FILTER ( Data, Data[Portfolio] = _portfolio ), Data[Nominal amount] )
    )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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