The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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 |
PC | 2018 | 12 | DEC | CAMRY | 1 |
PC | 2019 | 12 | DEC | CAMRY | 1 |
PC | 2020 | 12 | DEC | COROLLA | 1 |
SUV | 2018 | 12 | DEC | COROLLA | 1 |
SUV | 2019 | 12 | DEC | YARIS | 1 |
SUV | 2020 | 12 | DEC | FORTUNER | 1 |
SUV | 2018 | 12 | DEC | FORTUNER | 1 |
SUV | 2018 | 12 | DEC | FORTUNER | 1 |
CV | 2018 | 12 | DEC | CAMRY | 1 |
CV | 2018 | 12 | DEC | CAMRY | 1 |
SUV | 2018 | 12 | DEC | CAMRY | 1 |
SUV | 2018 | 12 | DEC | CAMRY | 1 |
CV | 2018 | 12 | DEC | CAMRY | 1 |
PC | 2018 | 12 | DEC | CAMRY | 1 |
PC | 2018 | 12 | DEC | CAMRY | 1 |
PC | 2018 | 12 | DEC | PRADO | 1 |
PC | 2018 | 12 | DEC | CAMRY | 1 |
PC | 2018 | 12 | DEC | COROLLA | 1 |
PC | 2018 | 12 | DEC | PRADO | 1 |
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
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
)
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.
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingThanks 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