Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Win a FREE 3 Day Ticket to FabCon Vienna. Apply now

Reply
Anonymous
Not applicable

line and Clustered Column Chart - count distintic do not exclude "no data values"

hi team, i'm very new to pbi and at the moment I only use the visualization tools and not DAX

i'm totally getting crazy since i'm tring to show on a line and clustered column chart some values but i would like to avoid any value that in my database is = empty cell

 

this because when i try to put these values on a chart, using the count distinct value, at the end i also have that the graph counting the values that are empty (and this generates a +1 value and it's not correct) empty = 1 in his calculation

 

any suggestion?

thanks

 

 

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

You can create a measure as below:

count of a = 
VAR _tab =
    SUMMARIZE (
        'Table',
        'Table'[a],
        "count of a", CALCULATE ( COUNT ( 'Table'[a] ), FILTER ( 'Table', 'Table'[a] <> BLANK () ) )
    )
RETURN
    SUMX ( _tab, [count of a] )

yingyinr_0-1613531068801.png

Best Regards

View solution in original post

8 REPLIES 8
Anonymous
Not applicable

Hi @Anonymous ,

I created a simple table as below to mockup your scenario:

ID Name
K1 aa
K2 bb
K3  
K4 cc
K5 dd
K6 ee
K7  
K8 ff

You can create a measure by right-click the related table the Fields pane and select New measure from the menu that appears. Then input the below formula in input box just as below screenshot.

Count distinct without blank values = COUNTA('Table'[Name])-COUNTBLANK('Table'[Name])

or

Count distinct without blank values = CALCULATE(DISTINCTCOUNT('Table'[Name]),'Table'[Name]<>BLANK())

count distinct.JPG

Best Regards

Anonymous
Not applicable

apologise yingyinr but i'm still facing difficulties

 

my table is like this

 

a       count of a

xx      1

yy      1

zz      1

          1

 

how can i make it count as 3 ando not 4?

Anonymous
Not applicable

Hi @Anonymous ,

You can create a measure as below:

count of a = 
VAR _tab =
    SUMMARIZE (
        'Table',
        'Table'[a],
        "count of a", CALCULATE ( COUNT ( 'Table'[a] ), FILTER ( 'Table', 'Table'[a] <> BLANK () ) )
    )
RETURN
    SUMX ( _tab, [count of a] )

yingyinr_0-1613531068801.png

Best Regards

amitchandak
Super User
Super User

@Anonymous , Try like

calculate(distinctcount(Table[column]), filter(Table, not(isblank(Table[column]))))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

calculate(distinctcount(Table[column]), filter(Table, not(isblank(Table[column]))))

 

where should i put it and how do i understand which is the table and the column name? thanks

Anonymous
Not applicable

where should i put it? apologize for my (Stupid) question

@Anonymous , I suggested a measure that will not count blank. Hope I got it right.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

the system says that syntax is incorrect

 

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.