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
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
Employee
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
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.