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
hello_MTC
Helper III
Helper III

New Column with Blank value Count

Hello there,

 

I have created a new table and added few column as seen in picture below.

I've also added a new column says "Counts"(DAX can be seen in picture). Currently it does count blank values from column "User_id" as '1'.

 

My concern is, I do no want to count balnk values available in column "User_id", it should be blank only.

What are the changes that i need to make in the dax functions seen in below picture? Also, If the column "Counts" extends more than number 9 than it should be return as '10+'. Just like table below.

hello_MTC_0-1657610092494.png

 

"

Counts = var _countrows = CountTable[Incident_id]
return
COUNTROWS(
FILTER(ALL(CountTable),
_countrows = CountTable[Incident_id]
))"

 

New Count Column.JPG

2 ACCEPTED SOLUTIONS
v-yiruan-msft
Community Support
Community Support

Hi @hello_MTC ,

You can update the formula of your calculated column [Counts] as below and check if it can return the correct result... Please find the details in the attachment.

Counts = 
VAR _count =
    CALCULATE (
        COUNT ( 'CountTable'[Incident_id] ),
        FILTER (
            'CountTable',
            'CountTable'[Incident_id] = EARLIER ( 'CountTable'[Incident_id] )
        )
    )
RETURN
    IF (
        ISBLANK ( _count ),
        BLANK (),
        IF ( _count <= 9, FORMAT ( _count, "General Number" ), "10+" )
    )

yingyinr_0-1657860404311.png

Best Regards

Community Support Team _ Rena
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

Hi @hello_MTC ,

Just update the formula of calculated column [Counts ]as below:

Counts =
VAR _count =
CALCULATE (
COUNT ( 'CountTable'[User_id] ),
FILTER (
'CountTable',
'CountTable'[Incident_id] = EARLIER ( 'CountTable'[Incident_id] )
)
)
RETURN
IF (
ISBLANK ( 'CountTable'[User_id] ),
0,
IF ( _count <= 9, FORMAT ( _count, "General Number" ), "10+" )
)

Best Regards

Community Support Team _ Rena
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

6 REPLIES 6
v-yiruan-msft
Community Support
Community Support

Hi @hello_MTC ,

You can update the formula of your calculated column [Counts] as below and check if it can return the correct result... Please find the details in the attachment.

Counts = 
VAR _count =
    CALCULATE (
        COUNT ( 'CountTable'[Incident_id] ),
        FILTER (
            'CountTable',
            'CountTable'[Incident_id] = EARLIER ( 'CountTable'[Incident_id] )
        )
    )
RETURN
    IF (
        ISBLANK ( _count ),
        BLANK (),
        IF ( _count <= 9, FORMAT ( _count, "General Number" ), "10+" )
    )

yingyinr_0-1657860404311.png

Best Regards

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

This is Perfect, but It is still not fixed. I need blank count if column user_id has balnk cells(Not on incident_id).

Hi @hello_MTC ,

You can update the formula of calculated column [] as below:

Counts =
VAR _count =
CALCULATE (
COUNT ( 'CountTable'[User_id] ),
FILTER (
'CountTable',
'CountTable'[Incident_id] = EARLIER ( 'CountTable'[Incident_id] )
)
)
RETURN
IF (
ISBLANK ( 'CountTable'[User_id] ),
BLANK (),
IF ( _count <= 9, FORMAT ( _count, "General Number" ), "10+" )
)

yingyinr_0-1659077906704.png

Best Regards

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

Hi, You're awesome. But, I mistakenly mentioned that I need blank if user_id is blank. Actually I need 0 if user_is has balnk cell values.

I am sorry for the inconvinience!

Hi @hello_MTC ,

Just update the formula of calculated column [Counts ]as below:

Counts =
VAR _count =
CALCULATE (
COUNT ( 'CountTable'[User_id] ),
FILTER (
'CountTable',
'CountTable'[Incident_id] = EARLIER ( 'CountTable'[Incident_id] )
)
)
RETURN
IF (
ISBLANK ( 'CountTable'[User_id] ),
0,
IF ( _count <= 9, FORMAT ( _count, "General Number" ), "10+" )
)

Best Regards

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

Awesome, I put the 0 in quotation mark and it worked. Thank you so much.

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.

Top Kudoed Authors