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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
sshook
Frequent Visitor

Divide rows by specific total row

I've looked through the boards and have seen solutions that came close to what I am trying but dont work exactly. 

I am looking to create a % Share metric based on dividing the sales of each product, by a row title "Total Products". Total Products is not a sum of the products listed below but includes every possible product in that category, some of which we dont pull data for. 

 

Essentially I need a measure that is [Product] / [Total Products] but both are in the same column in the same table. I have been able to use Filter to return the $ sales of "Total Products" but have not been able to replicate that value across the rest of the rows. 

 

 

sshook_0-1696969985614.png

 

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@sshook Assuming you have a production dimension with all the products, you can write the following measures to get the % and also the sum of all products at the total:

 

Base Measure = SUM ( Table[Sales] )

% Share = DIVIDE ( [Base Measure], CALCULATE ( [Base Measure], ALL ( ProductTable ) ) )

$ Sales for Visual = 
IF ( HASONEVALUE ( ProductTable[Product] ), [Base Measure], CALCULATE ( [Base Measure], ALL ( ProductTable ) ) )

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

3 REPLIES 3
parry2k
Super User
Super User

@sshook in PQ, you can always create a product  dimension table, reference your data table, remove all columns except product related columns, and then keep a distinct row of it. It will create a dimension table for you.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

sshook
Frequent Visitor

@parry2k The problem is I dont have a table that is that includes all products. We pull data from a syndicated database and the data pulls are too large if we include the entire product universe available. 

parry2k
Super User
Super User

@sshook Assuming you have a production dimension with all the products, you can write the following measures to get the % and also the sum of all products at the total:

 

Base Measure = SUM ( Table[Sales] )

% Share = DIVIDE ( [Base Measure], CALCULATE ( [Base Measure], ALL ( ProductTable ) ) )

$ Sales for Visual = 
IF ( HASONEVALUE ( ProductTable[Product] ), [Base Measure], CALCULATE ( [Base Measure], ALL ( ProductTable ) ) )

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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