cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Aha2022
Regular Visitor

Unit sales by product formula

Hello

I have a table shows the products name and I want to know what is the product percentage from all the quantity sold.

the formula is Unit Sales by Product (%) = Product Quantity Sold/ total Quantities Sold  

but I dont know how to write it as a measure. I need your help

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

To your visual, drag the product name column from the Data Table and write these measures

Qty sold = sum(Data[Quantity])

Qty sold across all products = calculate([Qty sold],all(Data[Product name]))

Qty sold (%) = divide([Qty sold],[Qty sold across all products])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

3 REPLIES 3
v-jayw-msft
Community Support
Community Support

Hi @Aha2022 ,

 

measure = 
var Product Quantity Sold = calculate(sum(sales),allexcept(table,[product]))

var total Quantities Sold = calculate(sum(sales),all(table))

return
Product Quantity Sold/Quantities Sold

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
Ashish_Mathur
Super User
Super User

Hi,

To your visual, drag the product name column from the Data Table and write these measures

Qty sold = sum(Data[Quantity])

Qty sold across all products = calculate([Qty sold],all(Data[Product name]))

Qty sold (%) = divide([Qty sold],[Qty sold across all products])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
amitchandak
Super User
Super User

@Aha2022 , The measure should be

 

Unit Sales by Product (%) = Divide(Sum(Table[Product Quantity Sold]), Sum(Table[total Quantities Sold])) 

 

 

Assume above are columns



Learn Power BI - Full Course with Dec-2022, with new DAX functions like Window, Index, Offset !!
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Formatted Profit and Loss Statement with empty lines

Helpful resources

Announcements
Carousel_PBI_Wave1

2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

Thank you 2022 Review

2022 Monthly Feature Releases

We had a great 2022 with a ton of feature releases to help you drive a data culture.