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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

Count/CountA counting wrong category

This is such a simple problem that I have spent HOURS trying to solve with no avail.

I have a table with plenty of categories, say A, B, C, D, etc. I have a measure that Counts values in column A, and filters them by name into a table. I have another identical measure for column B, but for some reason, it just returns identical values as the column A measure. It makes no sense and I'm ripping my hair out over here.

My table looks like this:

Name  |  Count of A  |  Count of B

Name1          3                      3
Name2          7                      7
Name3          4                      4          

and so on when A and B in reality have very different values. I don't understand what's happening. Please help me <3.

1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

Based on your description, I assume that you want to filter by player and get win% for each player. I created data to reproduce your scenario. The pbix file is attached in the end.

Table:

a1.png

 

Names(a calculated table):

Names = 
DISTINCT(
    UNION(
        DISTINCT('Table'[Winner's Name]),
        DISTINCT('Table'[Loser's Name])
    )
)

 

You may create a measure as below.

Win % = 
var result = 
DIVIDE(
    COUNTROWS(
        FILTER(
            ALL('Table'),
            [Winner's Name]=SELECTEDVALUE(Names[Name])
        )
    ),
    COUNTROWS(
        FILTER(
            ALL('Table'),
            OR(
                [Winner's Name]=SELECTEDVALUE(Names[Name]),
                [Loser's Name]=SELECTEDVALUE(Names[Name])
            )
        )
    )
)
return
IF(
    ISBLANK(result),
    0,
    result
)

 

Result:

a2.png

 

Best Regards

Allan

 

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

8 REPLIES 8
v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

Based on your description, I assume that you want to filter by player and get win% for each player. I created data to reproduce your scenario. The pbix file is attached in the end.

Table:

a1.png

 

Names(a calculated table):

Names = 
DISTINCT(
    UNION(
        DISTINCT('Table'[Winner's Name]),
        DISTINCT('Table'[Loser's Name])
    )
)

 

You may create a measure as below.

Win % = 
var result = 
DIVIDE(
    COUNTROWS(
        FILTER(
            ALL('Table'),
            [Winner's Name]=SELECTEDVALUE(Names[Name])
        )
    ),
    COUNTROWS(
        FILTER(
            ALL('Table'),
            OR(
                [Winner's Name]=SELECTEDVALUE(Names[Name]),
                [Loser's Name]=SELECTEDVALUE(Names[Name])
            )
        )
    )
)
return
IF(
    ISBLANK(result),
    0,
    result
)

 

Result:

a2.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

bhagyashripatil
Advocate I
Advocate I

Hello @Anonymous ,

 

Try ignoring any filters applied on the column, on which you are calculating Measure 'B'. You can achieve this in your DAX, by using ALL( ) function in your filter context of DAX.

 

Or you can share your masked DAX, so that I can get more clarity on your issue.

Anonymous
Not applicable

Pls see above explanation ❤️

danextian
Super User
Super User

Please post a sample data and your formulas.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
Anonymous
Not applicable

I can't provide data because it's sensitive. However, I have isolated the problem. 

My dataset is essentially [game_id] [winner's name] [loser's name] .

The reason I am having issues is that when I put [Count of Wins] and [Count of Losses] into a table, I don't have a common "name" column to filter them both into. 

@Anonymous , Do you have team or something like that to group /filter if not what is expected?

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
Anonymous
Not applicable

I do not. I just want a way to filter by player and get someone's win%, etc

Hello @Anonymous ,

Is your data in this format ?

Data.PNG

Please give some sample masked data, so that we get better idea. You can also give the sample output which you expect.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Kudoed Authors