Forum Discussion
Plot zero when there is no data in line chart solution affects the date filter
Hi,
I have almost the same issue as descibed here:
https://community.powerbi.com/t5/Desktop/Plot-zero-when-there-is-no-data-in-line-chart/td-p/506235
https://community.powerbi.com/t5/Desktop/Show-zero-when-there-is-no-data-in-line-chart/td-p/401921
I solved it with a measure: Count of CaseNumbers = COUNTX('Cases','Cases'[CaseNumber])+0
But then a new issue started: the axis of the Line Chart visualisation was fixed and could not move if a date-filter was applied. See screenshots
wrong filtering of the x-axis as it is not adjusting the rangecorrect range of x-axis (but null value issue exist in this picture)
In the first picture the date filter is only removing the data and set the rest to 0
in the second picture the date filter indeeds adjust the date range. This is how I want it. (But in this picture the issue of 0 values is not solved.
I tried also to play around with filters, but that was just to have no ALLFILTERS not affect the visual. I could not find the other way around, such as e.g. NO-FILTERS. I tried measure Count of CaseNumbers2 = CALCULATE(COUNTX('Cases','Cases'[CaseNumber])+0)
Please feel free to share what I'm overlooking here. If feels like it staring in my face... 😉
Thanks in advance!
Hi, Anonymous
Your data is not continuous, and the date column has a specific time.
So you need to create a column and an additional date table,then use that date in slicer.
Like this:
Column = DATE(YEAR([CreatedDate]),MONTH([CreatedDate]),DAY([CreatedDate])) Table = CALENDAR(MIN(testdataPowerBIcsv[CreatedDate]),MAX(testdataPowerBIcsv[CreatedDate]))Here is my sample .pbix file.Hope it helps.
If it doesn’t solve your problem, please feel free to ask me.
Best Regards
Janey Guo
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
7 Replies
- v-janeyg-msftCommunity Support
Hi, Anonymous
It’s my pleasure to answer for you.
According to your description,If the first picture just showed the wrong date range,you can set the start and end time period in the x-axis of the line chart.
Like this:
If it doesn’t solve your problem, please feel free to ask me.
Best Regards
Janey Guo
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- AnonymousNot applicable
Hi Janey Guo,
I checked my settings, but they are exactly the same as yours. (Although thanks for meantioning. Indeed something I could have overlooked)
Note that all my data is just in one table. So it should be something easy.
Also all my filters on the y-axis are working, only the CreatedDate on the x-axis isn't working.
Highly appreciate your help,
Catherine
- v-janeyg-msftCommunity Support
Hi, Anonymous
Try like this:
column:Year Month = format([Date],"mmm yyyy") measure := CALCULATE ( COUNTX ( 'Cases', 'Cases'[CaseNumber] ), ALLEXCEPT ( 'Cases', 'Cases'[YearMonth] ) )+0Could you mind providing some sample data ?So that we can help you more clearly.
If it doesn’t solve your problem, please feel free to ask me.
Best Regards
Janey Guo
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.