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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

How to change Month & year format in X-Axis?

My current graph is showing the Year & Month in "2019 July" format. But Iwant to show as "Jul 2019"/"Aug 2019" format. How can I show all of my Month & Year in X-Axis in "Jul 2019"/"Aug 2019" format? Please, see screenshot to understand my current month & year format.prob.jpg

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @Anonymous ,

I created some data:

vyangliumsft_0-1652173620839.png

Here are the steps you can follow:

1. Create calculated column.

MainTable:

mod = MOD('MainTable'[Month_value],2)

vyangliumsft_1-1652173620841.png

2. Create calculated table.

Table 2 =
SUMMARIZE('MainTable','MainTable'[Year_Month],'MainTable'[Year],'MainTable'[Month_value],'MainTable'[mod])

vyangliumsft_2-1652173620842.png

3. Create calculated column.

Calculated_table:

Group =
CALCULATE(SUM('Calculated_table'[mod]),FILTER(ALL('Calculated_table'),'Calculated_table'[Year]=EARLIER('Calculated_table'[Year])&&'Calculated_table'[Month_value]<=EARLIER('Calculated_table'[Month_value])))
Flag =
var _last=
CALCULATE(MAX('Calculated_table'[Year_Month]),FILTER(ALL('Calculated_table'),'Calculated_table'[Year]=EARLIER('Calculated_table'[Year])&& 'Calculated_table'[Group]=EARLIER('Calculated_table'[Group])&&'Calculated_table'[mod]=1))
var _next=
CALCULATE(MAX('Calculated_table'[Year_Month]),FILTER(ALL('Calculated_table'),'Calculated_table'[Year]=EARLIER('Calculated_table'[Year])&& 'Calculated_table'[Group]=EARLIER('Calculated_table'[Group])&&'Calculated_table'[mod]=0))
return
_last &"/"&_next

vyangliumsft_3-1652173620843.png

4. Create measure.

Measure =
var _yearmid=
VALUE(
RIGHT(MAX('Calculated_table'[Flag]),4)
)
var _monthmid=
MID(MAX('Calculated_table'[Flag]),10,3)
var _monthright=
LEFT(MAX('Calculated_table'[Flag]),3)
return
CALCULATE(SUM('MainTable'[rand]),FILTER(ALL('MainTable'),'MainTable'[Year]=_yearmid&&'MainTable'[Month]=_monthmid))
+
CALCULATE(SUM('MainTable'[rand]),FILTER(ALL('MainTable'),'MainTable'[Year]=_yearmid&&'MainTable'[Month]=_monthright))

5. Result:

vyangliumsft_4-1652173620846.png

Best Regards,

Liu Yang

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

4 REPLIES 4
Anonymous
Not applicable

Hi  @Anonymous ,

I created some data:

vyangliumsft_0-1652173620839.png

Here are the steps you can follow:

1. Create calculated column.

MainTable:

mod = MOD('MainTable'[Month_value],2)

vyangliumsft_1-1652173620841.png

2. Create calculated table.

Table 2 =
SUMMARIZE('MainTable','MainTable'[Year_Month],'MainTable'[Year],'MainTable'[Month_value],'MainTable'[mod])

vyangliumsft_2-1652173620842.png

3. Create calculated column.

Calculated_table:

Group =
CALCULATE(SUM('Calculated_table'[mod]),FILTER(ALL('Calculated_table'),'Calculated_table'[Year]=EARLIER('Calculated_table'[Year])&&'Calculated_table'[Month_value]<=EARLIER('Calculated_table'[Month_value])))
Flag =
var _last=
CALCULATE(MAX('Calculated_table'[Year_Month]),FILTER(ALL('Calculated_table'),'Calculated_table'[Year]=EARLIER('Calculated_table'[Year])&& 'Calculated_table'[Group]=EARLIER('Calculated_table'[Group])&&'Calculated_table'[mod]=1))
var _next=
CALCULATE(MAX('Calculated_table'[Year_Month]),FILTER(ALL('Calculated_table'),'Calculated_table'[Year]=EARLIER('Calculated_table'[Year])&& 'Calculated_table'[Group]=EARLIER('Calculated_table'[Group])&&'Calculated_table'[mod]=0))
return
_last &"/"&_next

vyangliumsft_3-1652173620843.png

4. Create measure.

Measure =
var _yearmid=
VALUE(
RIGHT(MAX('Calculated_table'[Flag]),4)
)
var _monthmid=
MID(MAX('Calculated_table'[Flag]),10,3)
var _monthright=
LEFT(MAX('Calculated_table'[Flag]),3)
return
CALCULATE(SUM('MainTable'[rand]),FILTER(ALL('MainTable'),'MainTable'[Year]=_yearmid&&'MainTable'[Month]=_monthmid))
+
CALCULATE(SUM('MainTable'[rand]),FILTER(ALL('MainTable'),'MainTable'[Year]=_yearmid&&'MainTable'[Month]=_monthright))

5. Result:

vyangliumsft_4-1652173620846.png

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Ashish_Mathur
Super User
Super User

Hi,

Create a Calendar Table with calculated column formulas for Year, Month name and Month number.  Sort the Month name column by the Month number.  Write this calculated column formula in the Calendar Table

Month_year = format(Calendar[date],"mmm yyyy")

Drag the Month_year column to the X-axis of your visual.

Hope this helps.


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

@PC2790 But, I want show the short form of month. Such as, "Jan 2019"/"Feb 2019" instead of "January 2019"/"February 2019". Also, want to show the serially. Such as, Jan 2019, Feb 2019, March 2019, ..., Jan 2020, Feb 2020, March 2020,..., Jan 2021, Feb 2021, March 2021... . Can you please help me with that?

PC2790
Community Champion
Community Champion

Hi @Anonymous ,

 

Try adding them individually rather than as a heirarchy.

PC2790_0-1651812168541.png

Outcome will be:

PC2790_1-1651812189743.png

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors