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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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