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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
MaliniBaktha
Helper II
Helper II

subtract count of categories from the column

Hi, 

I am working on the CAS score and I would like to do a subtraction of count( category 1) - count( category 2) 

CASexpected output (count of Promoters- count of detractors)
Promoter1.00
Promoter 
Promoter 
Passive 
Detractors
Detractors
Passive 

 

So I have to subtract the count of Promoters - count of detractors . I used calculate or sum function but getting errors . Any help would really appreciate 

2 ACCEPTED SOLUTIONS

Hi,

Try these measures

P = calculate(countrows(Data),Data[CAS score category]="Promoter")

D = calculate(countrows(Data),Data[CAS score category]="Detractor")

N = [P]-{d]

N % = divide([N],countrows(Data))

Drag the N % to a card visual.

Hope this helps.


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

View solution in original post

Thank you that worked ... 

View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

Share some data in a format that can be pasted in an MS Excel file and show the expected result.


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

Hi Ashish, 

 

Sorry I was not clear in my question 

MaliniBaktha_0-1692575520496.png

my data has customer ID and categories based on the score they gave now I want to do a dax that subtracts the count of DEtractors from count of Promoters as shown in the bar chart I have to show a value that subtracts the promoter - detractor. My graph is from the 500K data put as a bar chart. But the result I want is subtracting the promoter- detractor count.

Hi,

Try these measures

P = calculate(countrows(Data),Data[CAS score category]="Promoter")

D = calculate(countrows(Data),Data[CAS score category]="Detractor")

N = [P]-{d]

N % = divide([N],countrows(Data))

Drag the N % to a card visual.

Hope this helps.


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

Thank you that worked ... 

You are welcome.


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

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors