Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Count by Blank text

I am trying to count the number of hotels in "Hotel Names" that have blank "Descriptions" in the table below. My current measures keep on counting repeated names as additional hotels. Please help.

4 Replies

  • Try

    Blank = CALCULATE(DISTINCTCOUNTNOBLANK(Hotel[Hotel Name ]),not( ISBLANK(Hotel[Desc])))
  • Anonymous's avatar
    Anonymous
    Not applicable

    You can try the below DAX

     

    CALCULATE(DISTINCTCOUNT('Table (2)'[Hotel Nam]),FILTER('Table (2)','Table (2)'[Description] = ""))
  • v-lid-msft's avatar
    v-lid-msft
    Community Support

     Hi Anonymous ,

     

    If you want to calculate the amount that have empty description completely, such as following situation:

     

     

    If you do not want to count C, you can use the following measure:

     

     

    Count =
    COUNTROWS (
        FILTER (
            ADDCOLUMNS (
                SELECTCOLUMNS ( DISTINCT ( 'Hotel'[Name] ), "n", [Name] ),
                "MaxLength", MAXX (
                    FILTER (
                        ADDCOLUMNS ( 'Hotel', "DescriptionLength", LEN ( 'Hotel'[Description] ) ),
                        [DescriptionLength] = [n]
                    ),
                    [DescriptionLength]
                )
            ),
            [MaxLength] = 0
        )
    )

     

     

     

     

    BTW, pbix as attached.

     

    Best regards,

    Community Support Team _ Dong Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • v-lid-msft's avatar
    v-lid-msft
    Community Support

    Hi Anonymous ,

     

    How about the result after you follow the suggestions mentioned in my original post?Could you please provide more details about it If it doesn't meet your requirement?

     

    Best regards,

    Community Support Team _ Dong Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.