Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
UncleLewis
Resolver III
Resolver III

Display Year on X Axis Only on Month 1 (Jan)

Hi all,

How can I display the year on Row 2 of the x-axis of a Column Chart?
The Year should only display for Jan and should be aligned below Jan (or J)

The year should not display again until  Jan is encountered again for the following year

The image below is a mock-up from Excel.

I have the 1 letter abbreviation for the Month, and I have it sorted in chronological order, I just cannot figure out how to display the year on row 2 of the x-axis when the month is 1 (Jan)

 

Thanks

w
x axis col chart.png

1 ACCEPTED SOLUTION
UncleLewis
Resolver III
Resolver III

Thanks Phil,

I tried, I just cannot get the year to display on Row 2 of the x-axis, so I ended up opting to show the month name and year when the month number is 1. Not as good, but will have to suffice.

MonthNameAbbr =
VAR __MonthNbr = Month('Calendar'[Date])
VAR __MonthName = FORMAT( Calendar[Date], "MMMM")
VAR __Year = FORMAT( Calendar[Date], "YYYY")
VAR __MonthNameAbbr = CONCATENATE(
                        LEFT(__MonthName, 1),
                        REPT(UNICHAR(8203),__MonthNbr)
                    )
RETURN
    IF(
        __MonthNbr = 1,
        CONCATENATE(CONCATENATE(__MonthNameAbbr,UNICHAR(10)),__Year),
        __MonthNameAbbr
    )


 
x axis col chart f.png

View solution in original post

2 REPLIES 2
UncleLewis
Resolver III
Resolver III

Thanks Phil,

I tried, I just cannot get the year to display on Row 2 of the x-axis, so I ended up opting to show the month name and year when the month number is 1. Not as good, but will have to suffice.

MonthNameAbbr =
VAR __MonthNbr = Month('Calendar'[Date])
VAR __MonthName = FORMAT( Calendar[Date], "MMMM")
VAR __Year = FORMAT( Calendar[Date], "YYYY")
VAR __MonthNameAbbr = CONCATENATE(
                        LEFT(__MonthName, 1),
                        REPT(UNICHAR(8203),__MonthNbr)
                    )
RETURN
    IF(
        __MonthNbr = 1,
        CONCATENATE(CONCATENATE(__MonthNameAbbr,UNICHAR(10)),__Year),
        __MonthNameAbbr
    )


 
x axis col chart f.png
PhilipTreacy
Super User
Super User

Hi @UncleLewis 

 

You can't do that.  If you have the year on the 2nd row of the X axis, it will be centered on the data for that year, e.g.

year-center.png

 

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!


Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.