Forum Discussion

miriambb's avatar
miriambb
Helper I
4 years ago
Solved

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 ord...
  • themistoklis's avatar
    4 years ago

    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 )

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi  miriambb ,

    I created some data:

    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:

    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