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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Anonymous
Not applicable

Percentage Calculation

Hi - I tried to search but could not find the exact answer for this simple one - this is a matrix report filtered just to show 2023 deals by lead source.

 

I'd like to add a coulmn that shows the % that each lead source makes up of the total leads.

 

Is this snip enough for folks to go on?! Thanks

 

BI Percentage snip.PNG

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

Create a new measure.

count of id = 
var _a=SELECTEDVALUE('Table'[LeadSource(groups)])
var tmp=FILTER(ALL('Table'),[LeadSource(groups)]=_a)
var _ctn=COUNTROWS(tmp)
var _b=COUNTROWS(ALL('Table'))
return IF(HASONEVALUE('Table'[LeadSource(groups)]),_ctn,_b)

vtangjiemsft_0-1700733898399.png

Best Regards,

Neeko Tang

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

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Thanks will give that one a shot.

Anonymous
Not applicable

Hi @Anonymous  - thanks for the reply.  So the formula runs, but not sure its giving the correct result?

 

I pointed the DAX to the Opportunity table where the records sit:

Lead Source % of Total =
var _a=SELECTEDVALUE('Opportunity'[LeadSource (groups)])
var tmp=FILTER(ALL('Opportunity'),[LeadSource (groups)]=_a)
var _ctn=COUNTROWS(tmp)
var _b=COUNTROWS(ALL('Opportunity'))
return
IF(HASONEVALUE('Opportunity'[2023 Type]),BLANK(),
IF(HASONEVALUE('Opportunity'[LeadSource (groups)]),DIVIDE(_ctn,_b),1))
 
But the %'s don't quite look right? Also I'd like to remove the 2 total columns marked with an X and just leave the one marked with a tick.
 
I've also included a view of the matrix with the Columns removed to show the % (if useful?) plus have filtered our one row that had (Blank) as a row heading (and no values)
 
Thanks!
BI Percentage snip 2.PNG
 
 
 
Anonymous
Not applicable

Hi @Anonymous ,

 

Create a new measure.

count of id = 
var _a=SELECTEDVALUE('Table'[LeadSource(groups)])
var tmp=FILTER(ALL('Table'),[LeadSource(groups)]=_a)
var _ctn=COUNTROWS(tmp)
var _b=COUNTROWS(ALL('Table'))
return IF(HASONEVALUE('Table'[LeadSource(groups)]),_ctn,_b)

vtangjiemsft_0-1700733898399.png

Best Regards,

Neeko Tang

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

Anonymous
Not applicable

Hi @Anonymous ,

 

According to your description, here are my steps you can follow as a solution.

(1) This is my test data. 

vtangjiemsft_0-1700729600844.png

(2) We can create a measure. 

% of Total = 
var _a=SELECTEDVALUE('Table'[LeadSource(groups)])
var tmp=FILTER(ALL('Table'),[LeadSource(groups)]=_a)
var _ctn=COUNTROWS(tmp)
var _b=COUNTROWS(ALL('Table'))
return
IF(HASONEVALUE('Table'[2023Type]),BLANK(),
IF(HASONEVALUE('Table'[LeadSource(groups)]),DIVIDE(_ctn,_b),1))

(3) Then the result is as follows.

vtangjiemsft_1-1700729703293.png

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.