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
ImprovingCL
Regular Visitor

Line Chart using COUNTROWS measure only returning blank

I am new to PowerBI so this is probably a novice question.  I have a very simple table that I am trying to represent on a line chart but my COUNTROWS is returning a BLANK value, which is expected, but the suggestions from other posts to add 0 to the COUNTROWS return value or using the IF and ISBLANK combination do not seem to be working for me.

 

ImprovingCL_0-1613077932870.png

 

I created a measure as shown below.

 

 

LabelActivites = IF(ISBLANK(COUNTROWS('Table')), 0, COUNTROWS('Table'))

 

 

 

In my chart below, my settings are:

X Axis = Date

Values = LabelActivities

Legend = Activity

As can be seen, my measure is still returning blank values instead of '0'.

ImprovingCL_3-1613078783125.png

 

Any help in what I am overlooking would be greatly appreciated!

 

1 ACCEPTED SOLUTION

Hi,

You had not created a relationship between the tables.  You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

12 REPLIES 12
PhilipTreacy
Super User
Super User

Hi @ImprovingCL 

That measure shouldn't return Blank if your table contains the rows as shown in your image.

Have you used a Card visual to verify the value in the LabelActivities measure?

Can you please share your PBIX file?

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Hi @PhilipTreacy,

 

I can see in a Card Visual that the value being returned looks correct.  I have put my PBIX file in the link below.  

 

Shared Folder 

 

In the PBIX, the first page contains the visual using the data I am actually trying to represent correctly, but my "Sample" table is in there as well.

 

Thanks,

Chris

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Ashish_Mathur,

 

Thanks for the reply, that definitely looks like it fixes my sample chart, but when I try to apply that same approach using COALESCE to my production data 'DataProtectionSummary' on the first page, I do not get the same expected results.

 

ImprovingCL_0-1613137222863.png

 

I've also created a second Calendar based on my 'DataProtectionSummary' table as well just as you have done in the sample, but that seems to result in the line chart having constant values instead.

 

Capture.PNG

 

Could I be overlooking something?

 

Thanks,

Chris

You are welcome.  If my previous reply helped, please mark it as Answer.  As regards your second question, I cannot comment unless i see the file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Ashish_Mathur,

 

The same file has the table 'DataProtectionSummary' as well as that line chart on the first page.  

 

Thanks,

Chris

You simply have not followed what i shared in my solution PBI file.  Neither have you created the Calendar Table nor have you written the measure.  Please study my solution carefully and replicate i on your file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @Ashish_Mathur ,

 

I've gone ahead and updated the file to apply your approach.  I created a Calendar2 table and written a new measure in the DataProtectionSummary table as LabelActivities2 that mirrors what you had done with the sample data, but I am showing my results as just being a flat lines versus the expected values.

 

Data Protection.pbix 

 

Thanks,

Chris

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Ashish_Mathur ,

 

I may not be explaining my issue clearly.  I've modified my PBIX file to remove the Sample data as that was just temporary to try to help me identify how to create the measure to show what I was looking for.  Your first repsonse addressed that in the Sample data, but when trying to apply that to my real data, I do not get the expected results.

 

When I use this as my measure, my results are a flat lines in the line chart over my calendar versus showing data points for each date.

Measure = COALESCE(COUNTROWS('DataProtectionSummary'),0)

 

ImprovingCL_0-1613572146126.png

 

Data Protection.pbix 

 

Thanks,

Chris

Hi,

You had not created a relationship between the tables.  You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Ashish_Mathur ,

 

Awesome, thank you that does exactly what I was trying to do!

 

Thanks,

Chris

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.