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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
jm9999999
New Member

How do I plot a line chart

I don't think power BI likes my data.
I'm trying to plot an average week of data, as a line graph/chart that has been calculated and put in the sheet provided. If I were to do it in excel, I would just select all the data and click the line chart button in the insert ribbon. I am trying to achieve this in power BI.

Here is my data:

jm9999999_0-1695381289033.png

 

Currenty I'm only able to graph the counts of my values against the first column and I am unable to stop it from sorting by either values or my first column alphabetically.

 

How would I go about making a line chart and how would I makes sure power BI is not sorting anything.

1 ACCEPTED SOLUTION

@jm9999999 , In the line visual put the numeric value in y-axis and time value in x-axis[The text].

This will sort the x axis on the basis of the text string. Now in the table section, click on the day/time column[text column], this will open column tools on the menu above. Go to sort column by and sort it by index column.

ChiragGarg2512_0-1695394769535.png

 

For ex., in this the city names[Text] are sorted on the basis of city ID[numeric]. The sort column by option is visible by clicking on the city button in table pane.

 

View solution in original post

8 REPLIES 8
ChiragGarg2512
Solution Sage
Solution Sage

@jm9999999 , If this is what the requirement is,

ChiragGarg2512_0-1695382405469.png

Then,

1) This plotted for only 10 values of time.

2) Start by checking the data type of the day/time column.

3) X-axis -> time,

    Y-axis-> Other fields

4) On Y-axis column in visualization pane, right click the column that can give the option to select the function that is required. In this case, it is the average function.

 

If sorting continues, go to the three dots of the visual and sort accordingly. 

 

 

I had set my day time column to text. When I try to set it to time it drops the name of the day "Monday" and just displays the time and any day after Monday the day/time value errors due to the change in type. How would I make the format "nameOfDate" + "time" be considered time. or at the very least be similarly treated as an index or a timestamp.

There is no option to just have name of date + time. Have add the date, or create a column that can provide the distinction. In terms of text it will always sort the values one way or another.

 

Remember to use a 24-hour clock.

 

Is there anyway I can go about making a graph with these axis in power BI?

jm9999999_2-1695386488750.png

 

@jm9999999 Something could be done.

Try uploading the data using power Query and add another column of index. 

Click transform data in PowerBI desktop. Then Enter Data, after the data is added go to Add column and add index starting from 1. this would order all the texting.

 

Then the desired result could be achieved.

I've tried this,
I am unable to prevent it from sorting my data points unless I put the index first and sort by index. If I do that it doesn't display the day time on the chart. Double clicking on the current sort by option doesn't disable the sorting.

jm9999999_0-1695392786215.png

I need the graph in index order but I want the x -axis to display the day time column in index order.

 

@jm9999999 , In the line visual put the numeric value in y-axis and time value in x-axis[The text].

This will sort the x axis on the basis of the text string. Now in the table section, click on the day/time column[text column], this will open column tools on the menu above. Go to sort column by and sort it by index column.

ChiragGarg2512_0-1695394769535.png

 

For ex., in this the city names[Text] are sorted on the basis of city ID[numeric]. The sort column by option is visible by clicking on the city button in table pane.

 

Thank you so much, I have been tearing my hair out over getting this graph right!

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.