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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Fali324
Helper II
Helper II

Percentage Calculation

Hi 

 

I have two tables,
Fee Date -
Date 
Sector
New Fee

Financial Year
Date
FY
FQ

I've linked both the table using the date column and want to create a graph which shows the percentage contribution for each sector. I have a hierachy of FY & FQ so if I'm at the highest level it will show overall distibution for the whole FY but if I drill down to FQ it should show the contribution based on the quaters. 

 

How can I achieive this?

 

Here is my sample data and Percentage Contribution is what I want to achieve, I've based it on quaters for an example

FYFQDate - CopySector New Fee Year TotalPercentage Contribution
2024Q101/04/2024 00:00Sector 1£821,000.00 £        27,270,0003%
2024Q101/04/2024 00:00Sector 2£5,372,000.00 £        27,270,00020%
2024Q101/04/2024 00:00Sector 3£269,000.00 £        27,270,0001%
2024Q201/07/2024 00:00Sector 1£804,000.00 £        27,270,0003%
2024Q201/07/2024 00:00Sector 2£5,336,000.00 £        27,270,00020%
2024Q201/07/2024 00:00Sector 3£244,000.00 £        27,270,0001%
2024Q301/10/2024 00:00Sector 1£788,000.00 £        27,270,0003%
2024Q301/10/2024 00:00Sector 2£5,802,000.00 £        27,270,00021%
2024Q301/10/2024 00:00Sector 3£340,000.00 £        27,270,0001%
2024Q401/01/2025 00:00Sector 1£795,000.00 £        27,270,0003%
2024Q401/01/2025 00:00Sector 2£5,484,000.00 £        27,270,00020%
2024Q401/01/2025 00:00Sector 3£601,000.00 £        27,270,0002%
2024Q401/01/2025 00:00Sector 4£614,000.00 £        27,270,0002%
1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @Fali324 

 

Assuming that for FY level, the contribution is based on the year total over the total of all years and sectors, try this:

Contribution% = 
VAR _FQ =
    DIVIDE (
        SUM ( 'DataTable'[New Fee] ),
        CALCULATE (
            SUM ( 'DataTable'[New Fee] ),
            ALL ( FYFQ[FQ] ),
            ALL ( 'DataTable'[Sector] )
        )
    )
VAR _FY =
    DIVIDE (
        SUM ( 'DataTable'[New Fee] ),
        CALCULATE (
            SUM ( 'DataTable'[New Fee] ),
            ALL ( FYFQ[FY] ),
            ALL ( 'DataTable'[Sector] )
        )
    )
RETURN
    IF ( ISINSCOPE ( FYFQ[FQ] ), _FQ, _FY )

danextian_0-1738758249059.png

Otherwise, please provide the expected result for the year level and the reasoning behind.

Please see the attached pbix.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

4 REPLIES 4
danextian
Super User
Super User

Hi @Fali324 

 

Assuming that for FY level, the contribution is based on the year total over the total of all years and sectors, try this:

Contribution% = 
VAR _FQ =
    DIVIDE (
        SUM ( 'DataTable'[New Fee] ),
        CALCULATE (
            SUM ( 'DataTable'[New Fee] ),
            ALL ( FYFQ[FQ] ),
            ALL ( 'DataTable'[Sector] )
        )
    )
VAR _FY =
    DIVIDE (
        SUM ( 'DataTable'[New Fee] ),
        CALCULATE (
            SUM ( 'DataTable'[New Fee] ),
            ALL ( FYFQ[FY] ),
            ALL ( 'DataTable'[Sector] )
        )
    )
RETURN
    IF ( ISINSCOPE ( FYFQ[FQ] ), _FQ, _FY )

danextian_0-1738758249059.png

Otherwise, please provide the expected result for the year level and the reasoning behind.

Please see the attached pbix.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
Fali324
Helper II
Helper II

Hi, 

 

that doesn't work as all the sectors in a stacked graph show as 100%, any idea why that would happen?

The issue might be because of the Stacked Column Chart.

 

 

  • Insert a Stacked Column Chart.
  • Add the following fields:
    • X-Axis: FY => FQ (drag both to create a hierarchy for drill-down).
    • Legend: Sector (the breakdown by sector).
    • Values: PercentageContribution (this measure makes sure that the correct percentage is calculated).

 

 Please let me know if that works. If so please mark this as a solution so otheres can benefit too.

 

Please let me know if that works. If so please mark this as a solution so otheres can benefit too.

 

MichaelSamiotis
Resolver I
Resolver I

Hi @Fali324 ,

I would calculate 3 measures to do that.

 

TotalNewFee = 
SUM('Fee Date'[New Fee])

 

TotalFeeByPeriod = 
CALCULATE(
    SUM('Fee Date'[New Fee]),
    ALLSELECTED('Fee Date'[Sector])  // Keeps context for other filters while ignoring Sector
)

 

PercentageContribution = 
DIVIDE(
    [TotalNewFee], 
    [TotalFeeByPeriod], 
    0
)

 

Please let me know if that works. If so please mark this as a solution so otheres can benefit too.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.