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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Syndicate_Admin
Administrator
Administrator

Divide by the total without regard to categories

Good

I need help with the following problem: The percentage of the column Uds/Veh. is Units between Veh_Turismo but I would like the denominator to always be Nº VEHICLES. What happens is that column Veh_Turismo is disaggregated according to the categories that I have put in the table but I want that not to happen, that the denominator is always constant with the value 9221 in this case that has been calculated as SUM(Veh_Turismo) being Veh_Turismo a column of 1 and 0 being 1 when

[Vehicle Type]="Tourism".

duditasPBI_0-1737104844821.png

1 ACCEPTED SOLUTION

Hi @Syndicate_Admin 
If I understood you correctly 
You can use these measures :

Units_ = CALCULATE(sum('Table'[Units]),'Table'[Vehicles]=1)
Vaechiles_ =
CALCULATE(sum('Table'[Vehicles]),all('Table'))
Percent = DIVIDE( [Units_],[Vaechiles_])
OR
1 combined measure like :
percent combined =
var units = CALCULATE(sum('Table'[Units]),'Table'[Vehicles]=1)
VAR vechicles = CALCULATE(sum('Table'[Vehicles]),all('Table'))
Return
DIVIDE(units,vechicles)
Ritaf1983_0-1737119489634.png

The pbix is attached

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

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

3 REPLIES 3
Ritaf1983
Super User
Super User

Hi @Syndicate_Admin 

Please share sample data (excluding sensitive information) in text format, along with your expected result and any relevant logic. For guidance, refer to

How to provide sample data in the Power BI Forum

If possible, upload a simplified .pbix file using this guide:

 How to upload PBI in Community

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

UnitsVehiclesCategories
231a
651b
451c
210c
520b
351b
640a
201a
230b

CategoryCurrent Percentage: SUM(Units)/SUM(Vehicles)Expected Percentage: SUM(Units)/SUM(Vehicles)
a45/245/5
b100/2100/5
c45/145/5

In the real case, there are thousands of vehicles. They would be similar units but divided by, for example, 9221

Hi @Syndicate_Admin 
If I understood you correctly 
You can use these measures :

Units_ = CALCULATE(sum('Table'[Units]),'Table'[Vehicles]=1)
Vaechiles_ =
CALCULATE(sum('Table'[Vehicles]),all('Table'))
Percent = DIVIDE( [Units_],[Vaechiles_])
OR
1 combined measure like :
percent combined =
var units = CALCULATE(sum('Table'[Units]),'Table'[Vehicles]=1)
VAR vechicles = CALCULATE(sum('Table'[Vehicles]),all('Table'))
Return
DIVIDE(units,vechicles)
Ritaf1983_0-1737119489634.png

The pbix is attached

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

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

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!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.