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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
iLikeAzureSQL
Helper I
Helper I

How to calculate % of a data in PowerBI

Hello everyone,

My data set has values of 0 or 1 for a fact over another variable (consider shooting on target over distance)

I need to be able to graph and extract the % of successful target hits over the distance. How can I do this in PowerBI and graph ?

 

Data:

distance - hit

10,0

10,1

10,1

20,0

20,1

50,1

50,0

.

.

.

 

Results expected:

10 ft %89 sucess

20 ft %75 sucess

50 ft %54 sucess

100 ft %25 sucess

1 ACCEPTED SOLUTION

Just create the Measures and then a Table with the Fields organized as in Picture.

Shooting%.png

View solution in original post

11 REPLIES 11
ankitpatira
Community Champion
Community Champion

@iLikeAzureSQL follow steps below in power bi desktop modelling using DAX.

 

1. First create new measure called TotalVal using below code

 

TotalVal = SUM( YOURTABLE[hit] )

2. Then create another measure called FinalVal using code belwo

GrandVal = CALCULATE( [TotalVal], ALL(YOURTABLE) )

3. Lastly create another measure using code below to calculate percentage share

HitPct = [TotalVal]/[FinalVal]

4. Then change data type of measure created in last step to Percentage

Capture3.JPG

This approach work, no problem with  creating measures and percentage, but the values doesn't seems to be correct! I know my data and compared to the PowerBi calucaltion, it's way off, I'll digg to see what did I do wrong

Looks like your way is calculating percentage over the Grant total, this is not what I need!

My perpose is to find the percentage over the group, like %90 of hits from 10 ft are secessfull ( 9 out of 10 hits from 10 ft) and not %25 of hits are successful compared to total hits.

@iLikeAzureSQL Try these

 

Shooting%.png

This seems to be easy way to go, no doubt it will work, the onlything is that my data is not aggregated, it's not grouped by the distance, so I need to find another way to get these results off the core data.

 

Thanks for being interested and helping

Why does you data need to be aggregated? by distance?

 

Do you have a distance column?

 

I'm not sure what you mean...

I Posted my data at first, here is what it looks like

 

Data:

distance - hit

10,0

10,1

10,1

20,0

20,1

50,1

50,0

10,1

10.1

10,2

50,0

20,1

.

.

.

@iLikeAzureSQL Why don't you split the column in the Query Editor? Before you load in the Data Model

 

Split Column.png

Data is loaded, no problem there, and on seperate columns (plus many more other columns that are not related to this)

You gave me an spark now! is there any way in PowerBi to create a view based on existing data set? if yes, then I can create an aggrigated view for grouping and run my report based on view

 

Just create the Measures and then a Table with the Fields organized as in Picture.

Shooting%.png

Thank you for follow ups, the last post helped me to get to what I was looking for.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors