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
jcolby
Helper I
Helper I

Need to chart blank as 0 on a Line Graph AND obey Date Slicer

Greetings,

 

Relatively new to PowerBI.  I've been stuck on this issue for a while.  Checked around on here and found 50% of the solution I need.

I need to chart blank values as 0 on a Line Graph

 

I was able to do so using this measure:

Count of Ticket # = 
IF (
    ISBLANK(DISTINCTCOUNT('Ticket Statistics'[Ticket #])),
    0,
    DISTINCTCOUNT('Ticket Statistics'[Ticket #])
)

 

But now it shows 0 for dimensions outside of the slicer range, how do I still only show whats inside my selected range?

 

What do?

 

Thanks

1 ACCEPTED SOLUTION

Hi,

I do not see any problem at all.  Look at the Duplicate of page1 tab.  Download the 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
jcolby
Helper I
Helper I

@Ashish_Mathur 

Excellent!

Thank you very much

 

So in addition to needing the calendar table(have on my model, not on sample), I also needed the order column + month/order table to make it all work.

 

Is the month order table & its relation to the calendar table like that pretty standard?  Thanks again

 

 

You are welcome.  Yes, it is pretty much a standard.


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

Duly noted.

parry2k
Super User
Super User

@jcolby try this measure

 

 Count of Ticket # = DISTINCTCOUNT('Ticket Statistics'[Ticket #]) + 0


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k

Thanks for the reply!

 

Gave that measure a try but same results, still shows the 0s outside of the selected range

@jcolby do you have date dimension which you using for date slicer? How your tables are related? Seems like there is something else going on?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k I have only one table.  It contains a "Date Opened" field.  This is what I used on the slicer.

 

Do I need to create a month table + relationship and use that on the slicer?  Seen some things along those lines but didnt fully understand.

@jcolby yeah as a best practice, add date dimension in your model ( there are many posts on how to add date dimension) and then set relationship between date table and your transaction table, and use date from date dimension for slicer.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k Hey again,

 

Had some more time to work at this.  I've now added a date dimension table using:

Calendar = CALENDARAUTO()

And have setup a many:1 relationship from my original date opened column.

 

I added this to the slicer

 

It all works fine, except - my original issue is unchanged.  I still see the 0's outside of the selected range on the slicer.

And after working through this, I don't need any date dimensions that I didnt already have (Year & Month only), so though you mentioned its best practice to have a date dimension table, i dont believe it changes anything in my case

 

Is there a way to specify the measure should only touch rows that are inside my slicer range or something like that?

 

So close but cant get over this hump

Hi,

This should be possible.  Share the link from where i can download your PBI file.


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

Hi,

I do not see any problem at all.  Look at the Duplicate of page1 tab.  Download the PBI file from here.

Hope this helps.

Untitled.png


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

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.