Forum Discussion

sprbr0353's avatar
sprbr0353
Frequent Visitor
2 years ago

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.

 

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

 

 

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

 

 

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

  • Anonymous's avatar
    Anonymous
    Not applicable

    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.