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
BhagyashriM42
Frequent Visitor

Calculated column- percentage using different columns

Hello Community,

 

I want to calculate a calculated column where it will give the % of particular categories as given in the screenshot,I have tried using earlier function to get count of "Happy" and as well as others i.e "Trust","Awareness","Diversity" (I need to calculate for only 3 KPI's) but that calculated columns are not working to get % for final calculated column.File attached for the reference.Thank you in advance for your reference.

 

This output expected:

BhagyashriM42_0-1658591422476.png

 

Sample Data:

 

BhagyashriM42_1-1658594702854.png

 

Thank you in advance for your reference.

 

 

1 ACCEPTED SOLUTION

9 REPLIES 9
Ashish_Mathur
Super User
Super User

Hi,

You should be writing a measure for this - not a calculated column formula.  If you are interested, share the link from where i can download your PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi Ashish,

 

Right, I had done this on measure ,but there is a situation where I need a calculated column itself to take a lookup in other table and all other calculations are indirectly dependent.

 

Thanks,

Bhagyashri

@BhagyashriM42 you can PM to do a zoom call

BhagyashriM42
Frequent Visitor

Hello @SpartaBI ,

 

I have tried with below calculated columns,but with no luck (basically total of happy should only have divided total of awareness,total of trust,total of diversity other than these KPI should be blank)

Happy_tag =

if('Table'[KPI]="Happy","Happy",BLANK())

 

Other_tags =

if('Table'[KPI]="Trust","Trust",
if('Table'[KPI]="Awareness","Awareness",
if('Table'[KPI]="Diversity","Diversity",BLANK())))


Final_calcol =
VAR _current_category = 'Table'[Category]
VAR _current_agegroup = 'Table'[Age-Group]
VAR _condition_1 = 'Table'[Happy_tag]
VAR _condition_2 = 'Table'[Other_tags]

VAR _num = COUNTROWS(
FILTER('Table',
'Table'[Category] = _current_category
&& 'Table'[Age-Group] = _current_agegroup
&& 'Table'[KPI]= _condition_2

)
)

VAR _denum =
COUNTROWS(
FILTER('Table',
'Table'[Category] = _current_category
&& 'Table'[Age-Group] = _current_agegroup
&& 'Table'[KPI]= _condition_1

)
)

VAR _result = DIVIDE(_num, _denum)
RETURN
_result

 

Thank you so much for your quick response.

 

 

BhagyashriM42_0-1658609290751.png

 

Hey @BhagyashriM42, already very late my timezone. PM me tomorrow as early your timezone you can and we could do a quick zoom and look together

Hi @SpartaBI ,

 

Let me know when to connect.

 

Thanks,

Bhagyashri

 I'm free now

@BhagyashriM42 here is a link to the file with the solution:
Test-calcolfile.pbix


2022-05-19 17_30_22-Re_ Need help on DAX function with measure vs colu... - Microsoft Power BI Commu.png


Full-Logo11.png

SpartaBI_3-1652115470761.png   SpartaBI_1-1652115142093.png   SpartaBI_2-1652115154505.png

Showcase Report – Contoso By SpartaBI

SpartaBI
Community Champion
Community Champion

@BhagyashriM42 if I understood what you need then creare this calculated column:

 

Pct from Category and Age-Group = 
VAR _current_category = 'Table'[Category]
VAR _current_age_group = 'Table'[Age-Group]
VAR _current_kpi = 'Table'[KPI]
VAR _num = 
	COUNTROWS(
		FILTER('Table', 
		'Table'[Category] = _current_category 
			&& 'Table'[Age-Group] = _current_age_group 
				&& 'Table'[KPI] = _current_kpi
		)
	)
VAR _denum = 
	COUNTROWS(
		FILTER('Table', 
		'Table'[Category] = _current_category 
			&& 'Table'[Age-Group] = _current_age_group
		)
	)
VAR _result = DIVIDE(_num, _denum)
RETURN
	_result

 


2022-05-19 17_30_22-Re_ Need help on DAX function with measure vs colu... - Microsoft Power BI Commu.png


Full-Logo11.png

SpartaBI_3-1652115470761.png   SpartaBI_1-1652115142093.png   SpartaBI_2-1652115154505.png

Showcase Report – Contoso By SpartaBI

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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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