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

New Member

## Adequate Percentile of share on a matrix

Hi, I need to fix this code DAX to exibit the last image below:

% Share vendas brutas Agrupável =
VAR AllVendasBrutas =
CALCULATE ( [Vendas Brutas], ALL ( dLocalidades ) )
RETURN
DIVIDE ( [Vendas Brutas], AllVendasBrutas )

Before:

I need the measure to show the share like this image bellow

The share for continent is working, but I need that the share for category shows values that sum is 100%

Any doubts, reply this post. Thanks

1 ACCEPTED SOLUTION
Community Champion

To achieve this, you can use a different approach for calculating the % Share vendas brutas Agrupável for categories. You want the sum of this measure to be 100% for each category. Here's a modified version of your DAX code:

% Share vendas brutas Agrupável =
VAR AllVendasBrutas =

VAR TotalSalesByCategory =
CALCULATE([Vendas Brutas], ALLEXCEPT('YourTable', 'YourTable'[Category]))

RETURN
DIVIDE([Vendas Brutas], IF(ISFILTERED('YourTable'[Category]), TotalSalesByCategory, AllVendasBrutas))

2 REPLIES 2
Community Champion

To achieve this, you can use a different approach for calculating the % Share vendas brutas Agrupável for categories. You want the sum of this measure to be 100% for each category. Here's a modified version of your DAX code:

% Share vendas brutas Agrupável =
VAR AllVendasBrutas =

VAR TotalSalesByCategory =
CALCULATE([Vendas Brutas], ALLEXCEPT('YourTable', 'YourTable'[Category]))

RETURN
DIVIDE([Vendas Brutas], IF(ISFILTERED('YourTable'[Category]), TotalSalesByCategory, AllVendasBrutas))

New Member

It didn't work, but with a slightly change it works

% Share vendas brutas Agrupável =
VAR ShareContinente =

VAR ShareCategoria =
CALCULATE([Vendas Brutas], ALL(dCategoriaProdutos[Categoria]))

RETURN
DIVIDE([Vendas Brutas], IF(ISFILTERED(dCategoriaProdutos[Categoria]), ShareCategoria, ShareContinente))

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