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
NelsonDíaz1
Frequent Visitor

Total percentages

I have this data:

CountryFórmulaGTR 23
Costa RicaAdorlan147.305
Costa RicaZaldiar696.783
El SalvadorAdorlan110.572
El SalvadorZaldiar552.542
GuatemalaAdorlan292.941
GuatemalaZaldiar408.122

 

And I got this results:

NelsonDaz1_0-1697819689131.png

My problem is with the percentages. The thing is that I need that the total in every Country be the result of the Total divided by the total of the Country. What I mean nomerically is, for example; Costa Rica = 844.088/2.208.265 = 38.22%, but keeps the percentages of the products (Adorlan in Costa Rica it is 17.45 that is the result of divide 147.305/844.088.

Is it possible?

 

Im working with:

Total GTR 23 = SUM('Hoja1'[GTR 23])
Totales por País = CALCULATE([Total GTR 23],ALL(Hoja1[Fórmula]))
%País = DIVIDE([Total GTR 23],[Totales por País])
 
I tried adding Hoja1[Country] in Totales por País, but is not the result that I needed, because it divides 147.305/2.208.265
 
I would appreciate your help.
Thanks
1 ACCEPTED SOLUTION
Dangar332
Super User
Super User

Hi, @NelsonDíaz1 

try below  just adjust your table and column name

% =
var a = CALCULATE(SUM(country[gtr 23]),REMOVEFILTERS(country[Country]))
var b = CALCULATE(SUM(country[gtr 23]),REMOVEFILTERS(country[Fórmula]))
var c =SWITCH(TRUE(),
ISINSCOPE(country[Fórmula]),DIVIDE(SUM(country[gtr 23]),b),
ISINSCOPE(country[Country]),DIVIDE(SUM(country[gtr 23]),a)
)
return
c
 
Dangar332_0-1697823476060.png

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

View solution in original post

2 REPLIES 2
NelsonDíaz1
Frequent Visitor

Thanks man.! It is perfect.!

Dangar332
Super User
Super User

Hi, @NelsonDíaz1 

try below  just adjust your table and column name

% =
var a = CALCULATE(SUM(country[gtr 23]),REMOVEFILTERS(country[Country]))
var b = CALCULATE(SUM(country[gtr 23]),REMOVEFILTERS(country[Fórmula]))
var c =SWITCH(TRUE(),
ISINSCOPE(country[Fórmula]),DIVIDE(SUM(country[gtr 23]),b),
ISINSCOPE(country[Country]),DIVIDE(SUM(country[gtr 23]),a)
)
return
c
 
Dangar332_0-1697823476060.png

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

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.