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! Request now

Reply
powerbi-1evelop
New Member

Help with DAX

Hello Community,

 

I need your help in writing the DAX formula for below scenario.

 

i am explaining my use case with the below sample data.

 

powerbi1evelop_5-1683478917535.png

 

 

 

Now the requirement is to display the difference between noofbugs and bugsthreshold.
the formula for the same is  if((sum(noofbugs)-sum(bugsthreshold)<0,0,(sum(noofbugs)-sum(bugsthreshold))

the same formula is working when i have team name in my table visual as below.

 

powerbi1evelop_6-1683479083589.png

 

Now the problem i am facing is below.

 

when i take only vendor as part of visual the DAX expression is not working as expected.

 

Below is the report that i can see.

powerbi1evelop_7-1683479215658.png

 

But the expectation is below.

powerbi1evelop_8-1683479264835.png

 

lets take Vendor1 for example, we have TeamA and TeamB under Vendor1.

TeamA - NoofBugs=5 and Threshold = 6 now the difference is -1, as per above formula final result is 0

Team B - NoofBugs=4 and Threshold = 2 now the difference is 2, as per above formual final result is 2

As per my expectation DAX expression should display 0+2 =2

But it is displaying 1, beacuse it is calculating all the bugs for all the teams under vendor1(5+4), threshold is(6+2)
now the difference is 9-8=1, but this is not correct functionally.

 

How can i write my DAX expression to fulfill my usecase?

Please let me know incase of any questions.

 

Thanks...

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

These measures work

NB = SUM(Data[NoofBugs])
BT = SUM(Data[BugsThreshold])
Measure = SUMX(FILTER(SUMMARIZE(VALUES(Data[Team]),Data[Team],"ABCD",[NB]-[BT]),[ABCD]>0),[ABCD])

Hope this helps.

Untitled.png


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

View solution in original post

1 REPLY 1
Ashish_Mathur
Super User
Super User

Hi,

These measures work

NB = SUM(Data[NoofBugs])
BT = SUM(Data[BugsThreshold])
Measure = SUMX(FILTER(SUMMARIZE(VALUES(Data[Team]),Data[Team],"ABCD",[NB]-[BT]),[ABCD]>0),[ABCD])

Hope this helps.

Untitled.png


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
Top Kudoed Authors