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

Include count of blanks in a chart

I have a table with a column called States, where values are things like Closed, In Process, Hold, etc. In some rows, the value in this column is blank. I am trying to create a pie chart to show the total number of each state, but it doesn't include the blank values. I know you can create a measure using COUNTBLANK to get the number of blanks, but how do I include this value as a piece of my pie chart?

The chart looks like this

lauka_0-1612544004995.png



But when I add my measure as a value it becomes like this.

lauka_1-1612544037527.png


I just want one pie chart where it shows each of the states, including blank.

1 ACCEPTED SOLUTION

@Anonymous 

Actually here's a little surprise...

My sample data table:

Sample data.JPG

 

The measures:

1) Count State = COUNT('DataTable'[State])

2) Count Blanks = COUNTBLANK('DataTable'[State])

3) The final measure to use in the visual:

Count Including Blanks =  [Count State] + [Count Blanks]
 
And this is what you get:
Include blanks.JPG
 
I guess it wasn't too bad a guess after all!




Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

16 REPLIES 16
PaulDBrown
Community Champion
Community Champion

@Anonymous 

I'm hazarding a guess here but maybe you can achieve this by:

Create a measure to count the blanks. Let's call this [count blanks measure].
now create a new measure which is:

final measure = [your current measure] + [count blanks measure]

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Anonymous
Not applicable

My other values aren't calculated based on measures though. Are you saying I need to create a measure counting the number of each possible state and then combine it into a chart? I can see why this might work but I find it hard to believe there isn't any other way than to be creating measures for every possible value.

@Anonymous 

Sorry!! I did say I was hazarding a guess (while on the move..)

Ok, so, where do you want to show the blank values? as another field in the legend?

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Anonymous
Not applicable

No problem. I want to show them as a slice of the pie.

@Anonymous 

Actually here's a little surprise...

My sample data table:

Sample data.JPG

 

The measures:

1) Count State = COUNT('DataTable'[State])

2) Count Blanks = COUNTBLANK('DataTable'[State])

3) The final measure to use in the visual:

Count Including Blanks =  [Count State] + [Count Blanks]
 
And this is what you get:
Include blanks.JPG
 
I guess it wasn't too bad a guess after all!




Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Anonymous
Not applicable

It worked, thanks so much- and I apologize for doubting you!

@Anonymous 

There is actually a more "elegant" measure which will work:

Alternative measure =
COUNTROWS ( SELECTCOLUMNS ( 'DataTable', "state", 'DataTable'[State] ) )




Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






VijayP
Super User
Super User

@Anonymous 

In the Pie Chart Fields add Location into the Legend to get required visual!




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


BA_Pete
Super User
Super User

Hi @Anonymous ,

 

If you have access to Power Query (not direct query/live connection) then you can select your [State] column, go to Transform tab and Replace Values, then replace null with "Blank" or "".

 

This should then show the blanks as distinct dimension values on any visuals.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Anonymous
Not applicable

Unfortunately I can't edit the data since this is a power bi dataset.

Pragati11
Super User
Super User

Hi @Anonymous ,

 

First question. Are there BLANK values in the STATE column? I fthere are blanks then the piechart will show it by itself once you move the count in the values section. See below:

Pragati11_0-1612544558736.png

 

See I have got a LOCATION column with BLANK values and it shows in the pie-chart.

 

Can you share your screenshot as well like what you are moving at your end?

 

Thanks,

Pragati

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Anonymous
Not applicable

Yes, the blanks are in the state column. Here is what the fields look like.

lauka_0-1612545329309.png

 

lauka_1-1612545357699.png

blankState is my measure to count the blanks, since they are not showing in the first chart.

Hi @Anonymous ,

 

Can you just move normal COUNT of STATE in the VALUES section? your STATE column already has BLANK values in it, so just moving it to LEGEND should show a blank. You don't need a different measure for counting blanks like you see in my screesnhots. I don't have a measure to count blanks independently.

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Anonymous
Not applicable

State in the legend and the Count of State are the same column, so it's technically already in the legend.

Hi @Anonymous ,

 

No they are not.

In the Legend section when you move STATE column, it shows unique values in your STATE column.

In the Values section when you move COUNT(STATE) column, it counts the number of rows for the unique values in STATE column.

 

Also, what values you get when you just move STATE column in  a table visual?

Do you see a BLANK value in this column? Because I am still not convinced on this part. If the STATE column has BLANK value then it should show it in the LEGEND on pie-chart and so does it's distribution.

See like I have at my end:

Pragati11_0-1612546513873.png

 

Thanks,

Pragati

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Anonymous
Not applicable

When I moved Count of State into the legend, it just became State, like what I already had in there. There is a blank value in my State table.

lauka_0-1612547202642.png


Interestingly, when I have no fields in Values, the legend shows blank, but as soon as I add a field to values, it disappears. I have confirmed in the data that there are blanks (4 of them, to be exact).

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.