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

Power BI Charting Question

I have a situation where I want to show every month for this year on the X-axis, but if there is no data for a month, just leaves it blank (no 0 points or anything). Below is the chart I want, but I had to add 0 values to the table for Jan 2020 (circled in red).

 

Annotation 2020-05-22 132537.png

 

If there is no data in the "weather" table for Jan 2020, I want Jan 2020 to be on the x-axis, but it blank on the chart.

4 REPLIES 4
mahoneypat
Employee
Employee

Two potential suggestions 

1. Under the formatting options for the chart, fix the X-axis to your desired start date.

2. Add a constant measure (e.g., Constant = 1) and add that to your chart.  Color it so it is not visible.  It would show in your legend, of course.  Not a great option, but a potential quick fix.  You could even hide that part of the legend with a little white rectangle.

 

If this works for you, please mark it as solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


az38
Community Champion
Community Champion

Hi @espo4life 

first, create a calendar table like

Calendar = CALENDARAUTO()

or

Calendar = CALENDAR(date(2020,1,1), date(2020,12,31) )

then create a relationships between calendar table and your fact table by [Date] field and put Calendar[Date] field to x-axis of chart


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Thank you @az38  but it did not seem to solve my problem. Here is a samle pbix file with the table and my Date dimention and your Calendar one.

 

https://www.dropbox.com/s/23s68yqo7d782mq/weather.pbix?dl=0

 

Please look at it and see if/what I am missing. Thank you so much in advance!

 

 

az38
Community Champion
Community Champion

@espo4life 

you also can create a colum in calendar table

AvgTemperature = 
var _relatedTemperature = RELATED(WeatherHistory[AvgTemperature])
RETURN
IF(ISBLANK(_relatedTemperature); 0; _relatedTemperature)

and put Calendar[Date] to X axis and new column to Y

Снимок.PNG


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

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.