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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.