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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply

COUNT IF on DAX: Excel formula works so fine, but in PBI...

Hi everyone.

I have a spreadsheet that counts how many times a name appears in a listing and also counts how many times a conditional is listed. For example:

 

AYes
AYes
AYes
BYes
B 

 

In this case, the expected result is: 

A3 times
B1 time

In Excel it's perfect. But I couldn't replicate that in Power BI (I think it was the recent vacation effect).

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

Hi @LeandroCampacci,

You can use create a table visual with the category field and write a measure formula for counting calculations.

Measure =
CALCULATE (
    COUNTA ( Table[Category] ),
    FILTER ( ALLSELECTED ( Table ), [Status] = "Yes" ),
    VALUES ( Table[Category] )
)

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

2 REPLIES 2
v-shex-msft
Community Support
Community Support

Hi @LeandroCampacci,

You can use create a table visual with the category field and write a measure formula for counting calculations.

Measure =
CALCULATE (
    COUNTA ( Table[Category] ),
    FILTER ( ALLSELECTED ( Table ), [Status] = "Yes" ),
    VALUES ( Table[Category] )
)

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
danielwelch
Resolver II
Resolver II

Hi, try
calculate(count([Lettercolumn]),[listing column]="Yes")

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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