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

Calculate percentage based on several catgeories

Hi everyone,

 

I have tried several ways but I am unable to calculate percentage for the below:

I am trying to calculate percentage for NSW and VIC (see below table)

NSW Local = Local/(Local+Overseas)

NSW Overseas = Overseas/(Local+Overseas)

The above calculation should also be based on Year. Hope you guys can help. Thanks 

 

DMKICCurrencyYearAmount
ABCNSWLocal2019500
XYZVICLocal2019600
XYZVICLocal2020120
ABCVICOverseas2019800
ABCNSWLocal2020500
XYZVICLocal2021100
ABCVICOverseas2019900
ABCVICLocal2020100
XYZNSWOverseas2021780
XYZVICOverseas2019980
ABCNSWLocal2020123
ABCNSWLocal2021120
XYZVICOverseas2019794
XYZVICLocal2020852
XYZNSWLocal2019258
ABCNSWOverseas20211470
XYZVICLocal2022125
ABCVICOverseas2022423
XYZVICLocal2022324
ABCVICOverseas2022861
1 ACCEPTED SOLUTION
v-rzhou-msft
Community Support
Community Support

Hi @PXJ ,

 

I suggest you to create a measure and show it in a matrix.

Percentage =
VAR _AMOUNT =
    CALCULATE ( SUM ( 'Table'[Amount] ) )
VAR _TOTAL =
    CALCULATE (
        SUM ( 'Table'[Amount] ),
        ALLEXCEPT ( 'Table', 'Table'[Year], 'Table'[KIC] )
    )
RETURN
    DIVIDE ( _AMOUNT, _TOTAL )

Result is as below.

vrzhoumsft_0-1686212531689.png

 

Best Regards,
Rico Zhou

 

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-rzhou-msft
Community Support
Community Support

Hi @PXJ ,

 

I suggest you to create a measure and show it in a matrix.

Percentage =
VAR _AMOUNT =
    CALCULATE ( SUM ( 'Table'[Amount] ) )
VAR _TOTAL =
    CALCULATE (
        SUM ( 'Table'[Amount] ),
        ALLEXCEPT ( 'Table', 'Table'[Year], 'Table'[KIC] )
    )
RETURN
    DIVIDE ( _AMOUNT, _TOTAL )

Result is as below.

vrzhoumsft_0-1686212531689.png

 

Best Regards,
Rico Zhou

 

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

 

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.