Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Filtering the line graph visual based on time

Hi,

I'm trying to make a line graph on powerbi, that represents the number of sales happening over time of the day. But i want to represent only the peak hour sales. The table looks something like shown below (just a sample)

 

 

In PowerBI, I've used a line graoh visual with time on the x-axis, and count of Sales ID on y-axis.
I have used a 10 mins bins for the time. I have also kept the Peak hour filter on the powerBI visual.
Now the graph looks soemthing like this:

 

 

But i want the x-axis to only display the peak hours. i.e., i want to see the tickets sales only between 7AM-10AM and then 4PM-8PM and nothing in between. Is that possible?

Thanks in advance!

  • Anonymous's avatar
    Anonymous
    2 years ago

    I have used the bins in PowerBI and drill down options to make the graph more insightful. For now, this is good.
    Thanks everyone for your help.

    To do this:
    Right click on the time field in the Data Section, and click "New Group"

     

    You could set the size of groups/bins you want to have on the visual (I've used 15 mins)

    Now, by adding both bins and the time (in that order) in the visual along with the "Peak" filter. I'll be able to drill down on the visual.


    Drill down basically just shows the individual sales made within the 15 min bin (when I click on a data point on the above graph).

     

5 Replies

  • Anonymous , You can create an hour column and you can use that in the slicer

     

    Hour = hour(Table[Time])

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      That'll still show the 10AM-4PM on x-axis with 0 sales right

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous 

     

    amitchandak  Thank you very much for sharing!

     

    For your question about the visual wanting to show sales only during peak hours, you can try to resolve this by filtering on peak hours.

     

    I noticed in your screenshot there is a column that shows if that time period is a peak period, please try the following:

     

    Filtered Vision:

     

    Choose your line chart visual.

     

    Drag the Peak Hours column to the Filters pane.

     

    Set the filter to only show "peak" times.

     

     

    If you still have problems, it is best to provide the pbix file and be careful to delete sensitive data.

     

    Regards,

    Nono Chen

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

     

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi,

      Thanks for your reply. I've tried the filter, but it still shows the time in between the two peak hours on x-axis, without any sales on y-axis.

       

  • Anonymous's avatar
    Anonymous
    Not applicable

    I have used the bins in PowerBI and drill down options to make the graph more insightful. For now, this is good.
    Thanks everyone for your help.

    To do this:
    Right click on the time field in the Data Section, and click "New Group"

     

    You could set the size of groups/bins you want to have on the visual (I've used 15 mins)

    Now, by adding both bins and the time (in that order) in the visual along with the "Peak" filter. I'll be able to drill down on the visual.


    Drill down basically just shows the individual sales made within the 15 min bin (when I click on a data point on the above graph).