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
mich32
Frequent Visitor

How to have Year/Qtr on a Continuous X Axis

Hi Community,

I am banging my head on this one.  I've researched so much I may have missed the solution.  All I want to do is chart a line chart with 2 historical trend lines and then 2 basic linear trend lines for each of the 2 historical trend lines as show below.  I realize that the x-axis has to be a date or number in order for a trend line to be available in the Analytics pane, but I cannot get to the point with what I have all tried.

 

mich32_0-1659040320135.png

The snapshot below shows how far I get, but you can see that the x-axis does not contain the quarter, it just contains the year.  How I got to this point was by using DAX of Quarter = STARTOFQUARTER(Table[Date]).

 

mich32_1-1659040610952.png

 

Please, if anyone can help me out, it would be greatly appreciated!!!! 

4 REPLIES 4
Chainfire74
Helper I
Helper I

If you create a new date table using the code below, you can then use the YearQuarter column in the X axis. There are few other options to play around with in the table too.

 

EX TABLE =
ADDCOLUMNS (
CALENDAR (DATE(2000,1,1), DATE(2030,1,1)),
"DateAsInteger", FORMAT ( [Date], "YYYYMMDD" ),
"Year", YEAR ( [Date] ),
"Monthnumber", FORMAT ( [Date], "MM" ),
"YearMonthnumber", FORMAT ( [Date], "YYYY/MM" ),
"YearMonthShort", FORMAT ( [Date], "YYYY/mmm" ),
"MonthNameShort", FORMAT ( [Date], "mmm" ),
"MonthNameLong", FORMAT ( [Date], "mmmm" ),
"DayOfWeekNumber", WEEKDAY ( [Date] ),
"DayOfWeek", FORMAT ( [Date], "dddd" ),
"DayOfWeekShort", FORMAT ( [Date], "ddd" ),
"Quarter", "Q" & FORMAT ( [Date], "Q" ),
"YearQuarter", FORMAT ( [Date], "YYYY" ) & "/Q" & FORMAT ( [Date], "Q" )
)


)


@Chainfire74 - Thank you for responding with this option, however, I tried it out and I get the x-axis to read properly, but then I lose the ability to show a trend lines as you see here in my snapshot.  The trend line option goes away cause the x axis switches to categorical (purple arrow).  Any other thoughts? 🙄

mich32_0-1659112714671.png

 



mich32
Frequent Visitor

@MattAllington - Hey Matt, saw that you are a MVP and just can't find a solution to my issue.  Can you please take a look and see if you know how to help?  I also just submitted a sample file of the data that I'm working with.  Thank you!!!!

https://gppower-my.sharepoint.com/:u:/g/personal/michelle_miller_evergy_com/EbY_Q8tzaedMj0weYNRKEr0B...

mich32
Frequent Visitor

@amitchandak - Do you know the solution to my issue by chance?  

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.