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
miriambb
Helper I
Helper I

count if

Hi everone,

 

I am a new in PowerbI so getting used to the formulas. I am familiar with Tableau, and I would like to do this calculation:

 

If April 2022 is null and. May 2022 is not null. In order to do so, I created the following calculated field in Tableau

 

count(if isnull([may2022]) THEN [June2022] END )

 

Could someone help me with the equivalent in PowerBI?

Thank you

Miriam 

2 ACCEPTED SOLUTIONS
themistoklis
Community Champion
Community Champion

@miriambb 

 

New Measure =
SUMX (
TableName , -- Table Name
IF (
TableName [may2022] = BLANK(),
CALCULATE(COUNT( TableName [June2022] ))
)
)

 

OR 

 

New Measure = IF (CALCULATE ( COUNT( TableName [may2022] ) ) = BLANK (), CALCULATE ( COUNT ( TableName [June2022] ) ), 0 )

View solution in original post

Anonymous
Not applicable

Hi  @miriambb ,

I created some data:

vyangliumsft_0-1655168637806.png

Here are the steps you can follow:

1. Create calculated column.

count if =
IF(
    'Table'[April 2022] = BLANK() &&'Table'[may2022]<>BLANK(),
        COUNTX(FILTER(ALL('Table'),'Table'[April 2022] = BLANK() &&'Table'[may2022]),[ID]),
IF(
    'Table'[may2022]=BLANK(),
        'Table'[June2022]))

2. Result:

vyangliumsft_1-1655168637809.png

If I have misunderstood your meaning, Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data. Express the results in the form of pictures, we can help you better.

 

Best Regards,

Liu Yang

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

Hi  @miriambb ,

I created some data:

vyangliumsft_0-1655168637806.png

Here are the steps you can follow:

1. Create calculated column.

count if =
IF(
    'Table'[April 2022] = BLANK() &&'Table'[may2022]<>BLANK(),
        COUNTX(FILTER(ALL('Table'),'Table'[April 2022] = BLANK() &&'Table'[may2022]),[ID]),
IF(
    'Table'[may2022]=BLANK(),
        'Table'[June2022]))

2. Result:

vyangliumsft_1-1655168637809.png

If I have misunderstood your meaning, Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data. Express the results in the form of pictures, we can help you better.

 

Best Regards,

Liu Yang

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

miriambb
Helper I
Helper I

Hi @themistoklis 

 

the first option gives me some numbers but unfortunately, it's not counting everything correctly as I am getting a different value from my previous calculation... do you know why this may be? Option 2 returns 0

 

Thank you

Miriam

 

 

@miriambb 

 

Could you share with us a sample dataset on Excel and shows us what is the expected output?

This way we will create the right formula for you

themistoklis
Community Champion
Community Champion

@miriambb 

 

New Measure =
SUMX (
TableName , -- Table Name
IF (
TableName [may2022] = BLANK(),
CALCULATE(COUNT( TableName [June2022] ))
)
)

 

OR 

 

New Measure = IF (CALCULATE ( COUNT( TableName [may2022] ) ) = BLANK (), CALCULATE ( COUNT ( TableName [June2022] ) ), 0 )

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.

Top Solution Authors
Top Kudoed Authors