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
kartiklal7
Frequent Visitor

DAX to Calculate Weighted Percentage Based on Baseline Percentages and Revenue

Hi All,

 

I have a Baseline percentages table in the following format. I need to match this data with the corresponding data in my fact table so that when someone selects one of the groupings below, they are able to see the relevant basline percentages. 

kartiklal7_1-1661771097629.png

 

I have done that using the DAX below:

kartiklal7_2-1661771336903.png

 

If someone selects multiple products within the same theatre and region, I need to show a weighted baseline % based on revenue and the baseline rate. 

 

For example, if product A has sales of 100,000 and product B has sales of 50,000 and their respective baseline percentages are 95% and 90%, then their Weighted Baseline % should be: (95.0% x 100,000 + 90.0% x 50,000) / 150,000 = 93.3%.

 

How do I calculate this using DAX? 

 

3 REPLIES 3
tamerj1
Super User
Super User

Hi @kartiklal7 

not sure how does your report look like. However, if you are slicing sales by the columns from the 'Opportunities' table the you can try

Baseline Coverage Rate =
VAR SalesCoverage =
    SUMX (
        'Baseline % Reference Table',
        VAR CoveragePetcent = 'Baseline % Reference Table'[Baseline Coverage Rate]
        VAR ClientTheatreName = 'Baseline % Reference Table'[ClientTheatreName]
        VAR ClientRegionName = 'Baseline % Reference Table'[ClientRegionName]
        VAR ProductGrouping = 'Baseline % Reference Table'[Product Grouping]
        VAR Sales =
            CALCULATE (
                SUM ( Opportunities[Sales] ),
                Opportunities[ClientTheatreName] = ClientTheatreName,
                Opportunities[ClientRegionName] = ClientRegionName,
                Opportunities[Product Grouping] = ProductGrouping
            )
        RETURN
            Sales * CoveragePetcent
    )
VAR TotalSales =
    SUM ( Opportunities[Sales] )
RETURN
    DIVIDE ( SalesCoverage, TotalSales )

Hi @tamerj1 ,

 

Yes I am slicing sales from columns in the Opportunities table and also a Calendar table. 

 

kartiklal7_1-1661780418800.png

I don't think that formula gives me what I'm looking for. See circled column. 

 

I have calculated sales as a percentage of the baseline (see last column) but my issue is these don't sum when there are multiple selections (I think I understand why). Is there a way to get the sum for the last column when there are multiple selections and I can use that to calculate the weighted baseline %? 

@kartiklal7 

Please provide a screenshot of your data model. Also note that the baseline coverage rate column from the baseline % reference table in not summarized in the table visual therefore it is part of the filter context. 
is Sales As Percentage of Baseling a calculated column or a measure? If a column then in which table? 

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.

Top Solution Authors