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
huguest
Advocate II
Advocate II

Bar Chart by month with items with no data

Hello,

I am trying to create a stacked bar chart where the x-axix is a date.  I want to show a count by month over the last 12 calendar months, and show the months where there is no data (count = 0) on the axis.  Here is a sample data set.

 

DateSite
01Dec16C
01Mar17A
01Mar17B
01Jun17A
01Jul17A
01Sep17A
01Oct17A
01Nov17B
01Jan18C

 

I want the stacked bar chart to have a x-axis that goes from January 2017 to December 2017, and show the months where the count is 0 (Jan17, Feb17, Apr17, May17, Aug17 and Dec17). 

 

I am able to get a chart that shows March 2017 to November 2017, but does show Jan, Feb and Dec. [Date in "Date" format; Visual Level Filter - Date is in the last 12 calendar month]

 

I am also able to get one that shows January 2016 to December 2018. [Date in "Date Hierarchy" format; Visual Level Filter - Date is in the last 12 calendar month].

 

But I am unable to get one that starts in January 2017 and ends in December 2017.

 

ScreenShot.png

 

Any help would be appreciated!

 

Thank you,

Hugues.

1 ACCEPTED SOLUTION

Hi @huguest,

 

In that case, you can choose "months" rather than "calendar months" as shown in below screenshot.

1.PNG

 

Regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-yulgu-msft
Employee
Employee

Hi @huguest,

 

Create a calendar table which lists unique date values. And you should establish a one to many relationship from 'dimDate' to 'Fact date' based on [date] column.

dimDate =
FILTER (
    CALENDAR ( DATE ( 2016, 1, 1 ), DATE ( 2018, 1, 1 ) ),
    DAY ( [Date] ) = 1
)

1.PNG2.PNG

 

Then, create the stacked column chart, please pay attention to the hilighted part in below screenshots.

3.PNG4.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hello, thank you for your suggestion.  It did work to add the leading balnk months to my chart (i.e. january and February), but December is still not showing.

Hi @huguest,

 

Based on the steps mentioned in my original post, please change the axis type to "Categorical". Then, change [Date] field to "Hierarchy".

1.PNG2.PNG

 

Best regards,

Yuliana Gu

 

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you, the solution is working (for now).  I have under the impressiont that it will no longer work when I get into February and have to report on Feb2017 to Jan2018.  As the x-axis shows only themonth an not the year, I will end up with Jan2018 as my first bar, then Feb through Dec2017...

Hi @huguest,

 

In that case, you can choose "months" rather than "calendar months" as shown in below screenshot.

1.PNG

 

Regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.