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
PeterStuhr
Helper V
Helper V

Sales per week - no trend line when showing multiple years

Hi all,

 

I have trouble getting a trendline when using Year and Weeknumbers.

 

It will only let me select "Continous" if I only use Weeknumbers. But if I then select 2020 and 2021, it will combine week 1 2020 with week 1 2021 etc.

 

So I have to use Year and Weeknumbers in X axis. But then it wont let me make it Continous to get a trendline.

 

if someone can make it work to show multiple years with weeks, and a trendline - please send me the file!

 

THanks!

1 ACCEPTED SOLUTION
v-yuaj-msft
Community Support
Community Support

Hi @PeterStuhr ,

 

I think that because both fields are in the "axis", the horizontal axis is not a continuous variable, so the trend line function cannot be used.

v-yuaj-msft_0-1613468220621.png

 

As I mentioned before, unfortunately, Power BI currently cannot create trend lines based on categorical variables. You can use a R or Python visual instead. Hope these effects will be added soon.

 

Hope that's what you were looking for.

Best Regards,

Yuna

 

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

View solution in original post

7 REPLIES 7
Cyndiloo_92
Frequent Visitor

Following Up.... Did anyone ever figure out a "work around" for adding a trendline categorically? 

v-yuaj-msft
Community Support
Community Support

Hi @PeterStuhr ,

 

Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.

 

Best Regards,

Yuna

v-yuaj-msft
Community Support
Community Support

Hi @PeterStuhr ,

 

I think that because both fields are in the "axis", the horizontal axis is not a continuous variable, so the trend line function cannot be used.

v-yuaj-msft_0-1613468220621.png

 

As I mentioned before, unfortunately, Power BI currently cannot create trend lines based on categorical variables. You can use a R or Python visual instead. Hope these effects will be added soon.

 

Hope that's what you were looking for.

Best Regards,

Yuna

 

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

v-yuaj-msft
Community Support
Community Support

Hi @PeterStuhr ,

 

Based on your description, I did a test. From the test results, the line chart only provides a trend line when the x-axis variable is a continuous variable. You can create a simple calculated column as follows.

Column = YEAR([Date])*100+[week]
My test table:

v-yuaj-msft_0-1612508165577.png

Result:

0204.gif

 

Hope that's what you were looking for.

Best Regards,

Yuna

 

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

Hi @v-yuaj-msft 

 

Thanks, the problem with this is that it will just create a huge gab between 202053 and 202101, as shown in your 😕

 

So I think we have a big limitation here... Ideally, I would like something like this:

Capture.JPG

 

I can add an "Average" line, but it really annoys me that I can not make a trendline!

 

PeterStuhr
Helper V
Helper V

I still dont seem to be able to select "trendline" in the analysis pane?

amitchandak
Super User
Super User

@PeterStuhr , Not very clear. You can take year and week on axis and sort on that and switch off concatenate label off

Concat Label Off.pngConcat2.png

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.