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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
anwarsa
Regular Visitor

calculating percentage column wise

Hi,

 

I am new to Power BI  and  need some advice with respect to calculating the percentage column-wise

 

Segment  Year MONTH  month (Text) Product Sales Quantity 
PC201812DECCAMRY1
PC201912DECCAMRY1
PC202012DECCOROLLA1
SUV201812DECCOROLLA1
SUV201912DECYARIS1
SUV202012DECFORTUNER1
SUV201812DECFORTUNER1
SUV201812DECFORTUNER1
CV201812DECCAMRY1
CV201812DECCAMRY1
SUV201812DECCAMRY1
SUV201812DECCAMRY1
CV201812DECCAMRY1
PC201812DECCAMRY1
PC201812DECCAMRY1
PC201812DECPRADO1
PC201812DECCAMRY1
PC201812DECCOROLLA1
PC201812DECPRADO1

I need to calculate the segment contribution year-wise example my total sale for the PC segment in 2018 is 100 and all segment sales are 1000 so PC  share should be 100/1000  similarly SUV sales in 2018 is 300  and total sales 1000 so it should give me percentage by dividing 300/1000. Hope I am able to explain my problem. Thanks for support 

2 REPLIES 2
edhans
Super User
Super User

I don't understand where you are getting your 300, 1000, 100, and other numbers. Everything is 1 in your sales quantity.
I added a Date Table to do this correctly from here:  https://bit.ly/DateTableByEd

This measure gives you the % of current segment against the entire year. So 3 CVs were sold (your data) vs 15 for all of 2018, so CV is 20%.

Percent of Total = 
VAR varCurrentSales = [Sales]
VAR varTotalSales = 
    CALCULATE(
        [Sales],
        REMOVEFILTERS(Sales[Segment ])
    )
RETURN
    DIVIDE(
        varCurrentSales,
        varTotalSales,
        0
    )

edhans_0-1613606321133.png

My PBIX file is here if you want to play with it.

If this is not what you needed, please be clear on the expected results with data that matches your description.

How to get good help fast. Help us help you.

How To Ask A Technical Question If you Really Want An Answer

How to Get Your Question Answered Quickly - Give us a good and concise explanation
How to provide sample data in the Power BI Forum - Provide data in a table format per the link, or share an Excel/CSV file via OneDrive, Dropbox, etc.. Provide expected output using a screenshot of Excel or other image. Do not provide a screenshot of the source data. I cannot paste an image into Power BI tables.

 

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Thanks for your help, just to clarify me i am looking for similar results, would appreciate if u can give a step-wise solution. Do I need to create a DAX function for this ??.

I have shared the sample data file having a complete data set

https://drive.google.com/file/d/16GVi7YXJ-kUMjektCZrxtxlwqYdmx8hg/view?usp=sharing

https://drive.google.com/file/d/16GVi7YXJ-kUMjektCZrxtxlwqYdmx8hg/view?usp=sharing 

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.