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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
davebourgeois87
Frequent Visitor

How to Calculate Share Measures using Share Bases Identified in a Reference Table?

Hi Everyone,

 

I'm looking for guidance about how to incorporate a product reference table so that I can calculate multiple product share bases (i.e, category, segment, department, etc.). I have a normalized dataset that uses ProductID as the key between my data table and my product reference table and the relationship is set up correctly (simplifed example below). 

davebourgeois87_0-1671035488166.png

davebourgeois87_1-1671035511927.png

 

 

What I would like to be able to do is set up calculations like this: 

 

Dollar Share Segment = 
Var Numerator = [Dollars]
Var Denominator = Calculate([Dollars],ProductID = SegmentID

Return Numerator/Denominator

 

Dollar Share Category = 

Var Numerator = [Dollars]

Var Denominator = calculate([Dollars],ProductID = CategoryID

Return Numerator/Denominator

 

What I'm struggling with is the DAX function required to calculate the denominator. I'm not sure how to pull in the dollars for the required ProductIDs. I am not able to share an actual file due to data privacy guidelines that my company and my client have, but I'm just looking for any suggestions on which dax functions to use. Any help is greatly appreciated!

1 ACCEPTED SOLUTION
v-henryk-mstf
Community Support
Community Support

Hi @davebourgeois87 ,

 

To calculate share measures using share bases identified in a reference table, you can use a combination of the SUMPRODUCT and DIVIDE functions in a calculated column in your data table.

For example, if you have a table of sales data with columns for ProductID, Sales, and Category, and a reference table with columns for ProductID and Category, you can create a calculated column in your sales table called "Category Share" using the following formula

Category Share = SUMPRODUCT(Sales, DIVIDE(ProductID, Category))

This formula will use the reference table to identify the category for each product, and then calculate the share of sales for that category by summing the sales for each product and dividing by the total sales for the category.

You can use this same approach to calculate share measures for other share bases, such as segment, department, or any other category that you have identified in your reference table. The key is to use the reference table to identify the share base for each product, and then use the SUMPRODUCT and DIVIDE functions to calculate the share of sales for that share base.


If the problem is still not resolved, please provide detailed error information and test data. Looking forward to your reply.


Best Regards,
Henry


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-henryk-mstf
Community Support
Community Support

Hi @davebourgeois87 ,

 

To calculate share measures using share bases identified in a reference table, you can use a combination of the SUMPRODUCT and DIVIDE functions in a calculated column in your data table.

For example, if you have a table of sales data with columns for ProductID, Sales, and Category, and a reference table with columns for ProductID and Category, you can create a calculated column in your sales table called "Category Share" using the following formula

Category Share = SUMPRODUCT(Sales, DIVIDE(ProductID, Category))

This formula will use the reference table to identify the category for each product, and then calculate the share of sales for that category by summing the sales for each product and dividing by the total sales for the category.

You can use this same approach to calculate share measures for other share bases, such as segment, department, or any other category that you have identified in your reference table. The key is to use the reference table to identify the share base for each product, and then use the SUMPRODUCT and DIVIDE functions to calculate the share of sales for that share base.


If the problem is still not resolved, please provide detailed error information and test data. Looking forward to your reply.


Best Regards,
Henry


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.