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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.