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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
Anonymous
Not applicable

Count number of players based on slicer and row filter

Hi, thanks a lot for looking at this issue. Really appreciate anyone can help me to solve this issue. 

 

Here is the data first. 

PlayerGame namePlaythrough_ID
TomA56
TomA57
TomA58
TomB59
TomC60
TomC61
MaryA62
MaryA63
MaryB64
MaryC65
MaryA66
MaryB67
TomB68
MonicaC69
MonicaC70
MonicaC71
MonicaB72
MonicaA73
MonicaA74
MaryC75
VictoriaA76
VictoriaB77
VictoriaB78
VictoriaA79
VictoriaA80
VictoriaC81
VictoriaC82
SarahC83
SarahC84
SarahA85
SarahA86
SarahB87
SarahB88

 

2.png

Ideally, create two measures and put in the matrix:

MaxPlaythroughID = MAX('Table'[Playthrough_ID]) 
MaxPlaythroughID_Allselect = CALCULATE([MaxPlaythroughID]; ALLSELECTED('Table'[Game Name])) 
 
For each game, I would like to know how many players which have the same values (MaxPlaythroughID = MaxPlaythroughID_Allselect).
Thus, Game A has 2 players (Monica and Sarah) and Game C has 3 players (Mary, Sarah and Tom).
 
Then I want to replicate this result in a stacked bar chart which puts Game name in the Axis and the measure - # users dropoff in values in the value. 
 
What I write is 
# users dropoff =
      VAR table1 = SUMMARIZE('Table';
                                             'Table'[Player];
                                             "MaxPI"; [MaxPlaythroughID];
                                             "MaxPI_A"; [MaxPlaythroughID_Allselect])
RETURN CALCULATE(DISTINCTCOUNT('Table'[Player]); FILTER(table1; [MaxPI] = [MaxPI_A]))
 
Then this Stacked bar chart is not correct as I expect. They all output 5 players in both A and C. 
 
Please anyone can help me to check what is wrong with this measure - # users dropoff in values. How can i change it to get the expected result (A game = 2 players; C game = 3 players). Thanks a lot!
1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

Create measures

Measure =
IF (
    CALCULATE (
        MAX ( Sheet11[Playthrough_ID] ),
        ALLEXCEPT ( Sheet11, Sheet11[Player], Sheet11[Game name] )
    )
        = CALCULATE (
            MAX ( Sheet11[Playthrough_ID] ),
            FILTER ( ALLSELECTED ( Sheet11 ), Sheet11[Player] = MAX ( Sheet11[Player] ) )
        ),
    1,
    0
)

Measure 2 = CALCULATE(DISTINCTCOUNT(Sheet11[Player]),FILTER(ALLEXCEPT(Sheet11,Sheet11[Game name]),[Measure]=1))

Capture16.JPG

Best Regards
Maggie

 

Community Support Team _ Maggie Li
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
v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

Create measures

Measure =
IF (
    CALCULATE (
        MAX ( Sheet11[Playthrough_ID] ),
        ALLEXCEPT ( Sheet11, Sheet11[Player], Sheet11[Game name] )
    )
        = CALCULATE (
            MAX ( Sheet11[Playthrough_ID] ),
            FILTER ( ALLSELECTED ( Sheet11 ), Sheet11[Player] = MAX ( Sheet11[Player] ) )
        ),
    1,
    0
)

Measure 2 = CALCULATE(DISTINCTCOUNT(Sheet11[Player]),FILTER(ALLEXCEPT(Sheet11,Sheet11[Game name]),[Measure]=1))

Capture16.JPG

Best Regards
Maggie

 

Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Thanks a lot!

CheenuSing
Community Champion
Community Champion

Hi @Anonymous ,

 

Are you attempting to find out

 

The Number of Players by Game who have played same number of times ?

 

From your Data

 

A-Played 2 Times - 2 Players

A-Played 3 Times - 3 Players

B- Played 1 TIme - 1 Player

B- Played 2 times - 4 Players

C-Played 2 Times - 3 Players

C-Palyed 3 Times - 2 Players

 

If this is so create a summary table

ByGamePlayerCounts = SUMMARIZE('PlayersData',PlayersData[Game],'PlayersData'[Player],"Count",COUNTROWS(PlayersData) )
 
Link this table with your source table on Game on either table.
 
Put the Count as axis , Game as Legend and Player as values which will be
automatically CountofPlayers
 
Cheers
 
CheenuSing

 

Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!
Anonymous
Not applicable

Thank you so much for looking at this issue. 

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

Check out the October 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

Find out what's new and trending in the Fabric Community.