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
jonnyA
Responsive Resident
Responsive Resident

Having issues with a Trend line and the X axis with all month #'s not being displayed

Hello,

I have a chart with a trendline, but for some reason my months are only displaying the even #'s (See pic).

Anyone have any advice on how to display all the month #'s, 1 through12?  For example, display the odd #'s too.

jonnyA_1-1646079198304.png

 

10 REPLIES 10
JardaPernicka
Regular Visitor

Hi,

instead of numbers you could show month names. 

Create a new column (I assume 'Date' table)  with this DAX:

MonthName = FORMAT(DATE(1, 'Date'[Month number], 1), "MMM")
Use this column in your chart and see if this helps with label visibity issue.
Jarda 
PS: I voted for  idea quoted by  @TheoC this is often requested.
 
jonnyA
Responsive Resident
Responsive Resident

@v-henryk-mstf 

I'm sorry, just realized the new formula's should be used as a filter.  But how should the filter be used?

jonnyA_0-1646400510916.png

 

v-henryk-mstf
Community Support
Community Support

Hi @jonnyA ,

 

According to the internal logic of the powerbi desktop, trendlines can only be applied on the CONTINUOUS x-axis. But I suggest you can create two measures, one for odd months and another for even months, and put them in the filter. The reference is as follows:

vhenrykmstf_0-1646287638905.png

M_ = IF(MOD(MAX('Table (2)'[Month]),2)=1,1,0)

vhenrykmstf_1-1646287711500.png


If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


Best Regards,
Henry


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

@v-henryk-mstf you said create 2 measures, but im only seeing 1 measure you offered.

M_ = IF(MOD(MAX('Table (2)'[Month]),2)=1,1,0)
Is there another one i need?

Hi @jonnyA ,

 

If it is an odd month, create the first formula; if it is an even month, create the second formula.

M_1 = IF(MOD(MAX('Table (2)'[Month]),2)=1,1,0)
M_2 = IF(MOD(MAX('Table (2)'[Month]),2)=0,1,0)

 

Best Regards,
Henry


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

 

@v-henryk-mstf 

I cant put those formula's in my x axis?  Do you know why?

jonnyA_0-1646400100443.png

 

jonnyA
Responsive Resident
Responsive Resident

@TheoC , no problem!  Thank you for trying!

TheoC
Super User
Super User

Hi @jonnyA 

 

Can you change the "Continuous" to "Categorical" in the options on your visual (i.e. in your screenshot).

TheoC_0-1646088430449.png

 

This will fix the issue.


Thanks,

Theo 🙂

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

jonnyA
Responsive Resident
Responsive Resident

@TheoC , When changing to "Categorical" the trend line disappears and I dont see any way to add it back.

 

jonnyA_0-1646143760957.png

 

No option to add trend line when changing to Categorical.

jonnyA_1-1646143803445.png

 

 

 

Hi @jonnyA 

 

I don't believe it's possible.  It has been added as an idea but I don't believe it has yet been accepted. 

 

You can vote here: https://ideas.powerbi.com/ideas/idea/?ideaid=7c6f5e01-e034-45ca-b638-7d14d6816435

 

Sorry for the unfavourable outcome... for now.

 

Theo

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

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.