cancel
Showing results for
Did you mean:

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a \$100 discount. Register Now

Frequent Visitor

## Need Help in calculating percentage at total level in matrix

Hi All,

For example in below sceriao  at total level its showing 217 %  but its should be Total GP/Price %(45/210%)=21%

I have attached PBI file also

1 ACCEPTED SOLUTION
Community Support

1. create a measure with below dax formula

``````Gp Percentage =
VAR _gp =
SELECTEDVALUE ( 'Table'[GP] )
VAR _price =
SELECTEDVALUE ( 'Table'[Price] )
VAR sum_price =
SUMX ( ALL ( 'Table' ), [Price] )
VAR sum_gp =
SUMX ( ALL ( 'Table' ), [GP] )
RETURN
IF (
ISFILTERED ( 'Table' ),
DIVIDE ( _gp, _price ),
DIVIDE ( sum_gp, sum_price )
)
``````

2. add a matrix visual with table fields and measure

Please refer the attached .pbix file.

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

2 REPLIES 2
Community Support

1. create a measure with below dax formula

``````Gp Percentage =
VAR _gp =
SELECTEDVALUE ( 'Table'[GP] )
VAR _price =
SELECTEDVALUE ( 'Table'[Price] )
VAR sum_price =
SUMX ( ALL ( 'Table' ), [Price] )
VAR sum_gp =
SUMX ( ALL ( 'Table' ), [GP] )
RETURN
IF (
ISFILTERED ( 'Table' ),
DIVIDE ( _gp, _price ),
DIVIDE ( sum_gp, sum_price )
)
``````

2. add a matrix visual with table fields and measure

Please refer the attached .pbix file.

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Frequent Visitor

Hi @v-binbinyu-msft   Thankyou for reply its working if there only one dimension what if i have multiple hirechy for example in below condition :

I am unable to get the at subtotal level , do i need to apply group by kind of thing , please once check this scenrio also and let me know if get the solution for this .

Announcements

#### Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

#### Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

#### Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

#### Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors
Top Kudoed Authors