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

COUNTA - Display "-" in place of blank values

Hi all, 

 

 

I have the following code (and several simialr) plugged into a matrix table:

NTF data total count (planned) =

COUNTA(‘data set 1’[1: Booking Solutions - 1: Planned])+

COUNTA(‘data set 1’[5: Document Management / File Sharing  - 5: Planned])+

COUNTA(‘data set 1’[6: Electronic / Card Payment  - 6: Planned])+

COUNTA(‘data set 1’[10: Human Resource Management HRM - 10: Planned])+

COUNTA(‘data set 1’[14: Server / Infrastructure  - 14: Planned])+

COUNTA(‘data set 1’[16: Software Hardware Upgrades - 16: Planned])+

COUNTA(‘data set 1’[22: Voice Over IP VoIP - 22: Planned])+

COUNTA(‘data set 1’[25: Website e-Commerce  - 25: Planned])


My question is, how would I get it to return blank measures as a "0" or "-". 

Capture.PNG

Many thanks in advance. 

1 ACCEPTED SOLUTION
MartynRamsden
Solution Sage
Solution Sage

Hi @Anonymous 

 

To return 0, you can simply add '+0' to the end of your DAX expression.

 

To return '-', you can use the following:

 

NTF data total count (planned) =
VAR DataCount =
    COUNTA ( 'data set 1'[1: Booking Solutions - 1: Planned] )
        + COUNTA ( 'data set 1'[5: Document Management / File Sharing  - 5: Planned] )
        + COUNTA ( 'data set 1'[6: Electronic / Card Payment  - 6: Planned] )
        + COUNTA ( 'data set 1'[10: Human Resource Management HRM - 10: Planned] )
        + COUNTA ( 'data set 1'[14: Server / Infrastructure  - 14: Planned] )
        + COUNTA ( 'data set 1'[16: Software Hardware Upgrades - 16: Planned] )
        + COUNTA ( 'data set 1'[22: Voice Over IP VoIP - 22: Planned] )
        + COUNTA ( 'data set 1'[25: Website e-Commerce  - 25: Planned] )
VAR Result =
    IF ( ISBLANK ( DataCount ), "-", DataCount )
RETURN
    Result​

 

Best regards,

Martyn

View solution in original post

2 REPLIES 2
MartynRamsden
Solution Sage
Solution Sage

Hi @Anonymous 

 

To return 0, you can simply add '+0' to the end of your DAX expression.

 

To return '-', you can use the following:

 

NTF data total count (planned) =
VAR DataCount =
    COUNTA ( 'data set 1'[1: Booking Solutions - 1: Planned] )
        + COUNTA ( 'data set 1'[5: Document Management / File Sharing  - 5: Planned] )
        + COUNTA ( 'data set 1'[6: Electronic / Card Payment  - 6: Planned] )
        + COUNTA ( 'data set 1'[10: Human Resource Management HRM - 10: Planned] )
        + COUNTA ( 'data set 1'[14: Server / Infrastructure  - 14: Planned] )
        + COUNTA ( 'data set 1'[16: Software Hardware Upgrades - 16: Planned] )
        + COUNTA ( 'data set 1'[22: Voice Over IP VoIP - 22: Planned] )
        + COUNTA ( 'data set 1'[25: Website e-Commerce  - 25: Planned] )
VAR Result =
    IF ( ISBLANK ( DataCount ), "-", DataCount )
RETURN
    Result​

 

Best regards,

Martyn

Anonymous
Not applicable

Many thanks, that worked perfectly

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 Solution Authors