Forum Discussion

tiztrain's avatar
tiztrain
Icon for Helper I rankHelper I
7 years ago

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:

 

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

 

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:

 

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