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
chandi
New Member

Card trouble - need a DAX solution

Need help with a DAX formula. I am trying to add a filter to a card to achieve "Blank" cards when the condition is not met.  The condition is that 5 players or more must play in order for the card to show the data.

 

Weighted average score is a measure of how all players did in a particular sport on a particular day (governed by slicers on the page) - 

WeightedAvgScore = SUMX([PlayerScore] * [Weight]) / SUMX([Weight])

 

# of players depends on the sport and the day-

I created the #ofplayers flag as a measure to see if 1's and 0's could help with filtering. It did not. 

 

TeamSportWeightedAvgScore# of players#ofplayersMeasure (flag)
School ASoccer20101
School ATennis3420
School ABaseball63121
School BSoccer123101
School BFootball2330
School BBaseball26121
School CFootball36101
School CTennis3220
School CBaseball23121

 

Desired result on card is the last column:

Result Display when # of players > 5
TeamSportWeightedAvgScore CARD
School ASoccer20
School ATennisBlank
School ABaseball63
School BSoccer123
School BFootballBlank
School BBaseball26
School CFootball36
School CTennisBlank
School CBaseball23

 

This forumla did not filter properly - 

 

=SUMX(FILTER(Table1
CALCULATE(DISTINCTCOUNT([PlayerID),[PlayerID]>15)),
SUMX([PlayerScore] * [Weight]) / SUMX([Weight])

 

Please help! 

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@chandi - 

5 or more measure =
  VAR __Team = MAX([Team])
  VAR __Sport = MAX([Sport])
  VAR __5orMore = IF([# of players] >=5,1,0)
RETURN
  IF(__5orMore,[WeightedAverage],BLANK())

Assumes a WeightedAverage measure. Do you need help with that as well? 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@chandi , Try like

Measure =
var _dist =CALCULATE(DISTINCTCOUNT([PlayerID]))
return
SUMX(FILTER(Summarize(Table1,Table1[Team] ,Table1[Sport],"_1",_dist, "_2",SUMX(Table,[PlayerScore] * [Weight]),"_3",SUMX([Weight])),[_1]_dist>15),divide([_2] /[_3] ))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Unfortunately I could not get this to work. Thank you for the reply though.

Greg_Deckler
Community Champion
Community Champion

@chandi - 

5 or more measure =
  VAR __Team = MAX([Team])
  VAR __Sport = MAX([Sport])
  VAR __5orMore = IF([# of players] >=5,1,0)
RETURN
  IF(__5orMore,[WeightedAverage],BLANK())

Assumes a WeightedAverage measure. Do you need help with that as well? 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Yay! Thank you Greg! It worked on the second try.

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.