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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
tiztrain
Helper I
Helper I

Line Chart X-Axis Type and NaN issue

Hi,

 

I am trying to setup a Trend Line for a Line Chart. Currently it does not appear in the Analytics tab but I know I need to change the X-Axis to Type Continuous.

 

When I do, it reverts back to Categorical. 

 

I have read the following below where I need to have a date hierarchy with continuous dates: 

https://community.powerbi.com/t5/Desktop/Axis-Labels-when-using-Trend-Line/m-p/498906#M232716 

 

As far as I can see, everything is setup as need be:

capture.png

 

I did just notice the exclamation point which when I tap on it I get the following error:

capture1.png

 

I know this issue has something to do with the hierarchy date as if use another column from my Calendar table, that error does not show up. 

 

I duplicated the page and converted the chart to a Matrix and got no issues:

capture3.pngcapture2.png

 

The DAX for my Calendar table is as follows:

PROD Calendar =
VAR Days = CALENDAR(MIN('LCP_Contacts'[Visited Date]),MAX('LCP_Contacts'[Visited Date]))
RETURN ADDCOLUMNS(
  Days,
  "Year", YEAR([Date]),
  "Year Sort", 10000 - YEAR([Date]),
  "Month Number", MONTH([Date]),
  "Month", FORMAT([Date],"mmmm"),
  "Month Year Number", YEAR([Date]) * 100 + MONTH([Date]),
  "Month Year Text", FORMAT([Date],"mmm yyyy"),
  "Date Month Number", DAY([Date]) + MONTH([Date]) * 100 + YEAR([Date]) *10000,
  "Date Month Text", FORMAT([Date], "dd mmm"),
  "Fiscal Year", YEAR([Date]+184),
  "Fiscal Year Sort", 10000 - YEAR([Date]+184)
)

 

I also tried the following to check if there are any errors in the Date Column:

Measure = ISERROR(SUM('PROD Calendar'[Date]))

Which came back false.

 

I am a bit lost what to do from here.

 

Thanks

4 REPLIES 4
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @tiztrain,

 

I was not able to reproduce this problem on my side. Would you please share your sample .pbix file so that I can check for you? Do mask senssive data before sharing.

 

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.

Hey @v-yulgu-msft,

 

Did you get my message with the link to the file?

tiztrain
Helper I
Helper I

Also when making the change from Date Hierarchy to Date, the exclamation point disappears and I can do a Trend line:

capture4.png

OK found out that @SteelBreeze's comment solves the issue of the NaN error I have:

https://community.powerbi.com/t5/Desktop/Chart-data-contains-not-a-number-NaN-values/m-p/479347/high...

 

Still can't change the X-Axis type from Categorical to Continuous

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.