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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
sprbr0353
Frequent Visitor

How to plot a variable vs. date?

Hello, 
I am pretty new to powerBI, and I encountered a problem with plotting using the line chart. I have a dataset of time and another numeric variables. The time variable is on hourly basis and data looks like 2006-11-01 1:00:00 AM, 2006-11-01 2:00:00 AM, and so on for several years. After importing the data set, the time variable is recognized as Date/Time. My other numeric variable is in Decimal format.

However, when it goes for plotting using line chart, I cannot figure it out how to plot the numeric variable over years and in hourly basis. I am looking to have a chart like the attachment.
time.PNG

 

The problems I have: 1. The Time vatibale is not broken down into hours in date hierarchy

 

Capture.PNG

 

2. it only counts, sum, average, etc. but not the numeric value of the parameter on the plot.

 

Capture2.PNG

 

and, I already read a lot of topics on the forum and tries many of them but none of them worked for me. I have changed the numeric variable to "Don't summarized", and the data type for that is "decimal number".

1 REPLY 1
v-yilong-msft
Community Support
Community Support

Hi @sprbr0353 ,

In response to your question, here are my thoughts.

In the Data pane, expand your dataset and select the checkbox next to your time variable (which is recognized as Date/Time).Then expand the Date field and select the checkbox next to Hour.This will create a hierarchy where your time variable is broken down into hours. You can read this topic for the further study: How to add Hours to Date Hierarchy in Power BI - Microsoft Fabric Community

 

You can use a line chart, but it’s essential to set it up correctly. Drag your time variable (with the hour breakdown) to the Axis field well. Drag your numeric variable to the Values field well. Ensure that the aggregation function (e.g., sum, average) is set to the appropriate one for your numeric variable. Adjust any other visual settings (such as color, legend, etc.) as needed.

 

 

 

Best Regards

Yilong Zhou

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

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.