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
Deepikapbi_9
Regular Visitor

Dynamic Total Calculation Issue- Need Help on achieving the correct totals

Deepikapbi_9_0-1714199397531.png

Deepikapbi_9_1-1714199412575.png

I have a Power BI report with specific country information containing sales details for different manufacturers and segments.
The report utilizes two slicers: one for selecting manufacturers and another for selecting segments.
The aim is to calculate the percentage share of each manufacturer's sales within the selected segment(s).
However, not all manufacturers have sales data for all segments, leading to inaccuracies in the percentage calculation.

When a Segment is selected, the total sales should adjust for all Manufacturers, and when a Manufacturer is selected, it should display the total sales across all selected Segments, even if there are no sales recorded for those Segments under the chosen Manufacturer.

In the above image if Manufacturer A is selected the desired total sales should come out as 23000.

Any guidance or assistance on how to achieve the desired behavior would be greatly appreciated.

3 REPLIES 3
Deepikapbi_9
Regular Visitor

Hi @v-heq-msft 

I've put your suggestions into action and experimented with using both "SUM BY SEGMENT" and "Total Sales" as denominators for calculating the percentage. However, the outcomes haven't quite matched our expectations.

In the example I showed earlier, I only used the manufacturer and segment info. But in reality, we also have a country column.

When I use "total sales" to calculate the percentage, it's fine. But when I pick a manufacturer, the numbers go wonky. Both "total sales" and "sum by segment" act like the total sales are 22990 for manufacturer A, which isn't right. So, the percentage ends up being wrong too.

Deepikapbi_9_0-1714467949918.png

Deepikapbi_9_1-1714467966150.png

v-heq-msft
Community Support
Community Support

Hi @Deepikapbi_9 ,
Here some steps that I want to share, you can check them if they suitable for your requirement.
Here is my test data:

vheqmsft_1-1714357503046.png

Create measures

 

SUM = SUM('Table'[Sales])
SUM BY SEGMENT = 
CALCULATE(
    [Total Sales],
    REMOVEFILTERS('Table'[MANUFACTURER]),
    VALUES('Table'[SEGMENT])
)
Total Sales = 
CALCULATE(
    SUM('Table'[Sales]),
    ALL('Table'[MANUFACTURER])
)
Percentage = [SUM]/[SUM BY SEGMENT]

 

These will calculate the percentage of the same SEGMENT that each MANUFACTURER accounts for, and if you want to display the total even after selecting the MANUFACTURER, you can do so by simply selecting the option in the MANUFACTURER
Final output

vheqmsft_2-1714357681430.png

Best regards,

Albert He

 

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

 



 

Deepikapbi_9
Regular Visitor

PS : Measure for Total Sales = CALCULATE(SUM('Table'[Sales]), ALL('Table'[MANUFACTURER])

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.