Forum Discussion

Syndicate_Admin's avatar
Syndicate_Admin
Icon for Administrator rankAdministrator
1 year ago
Solved

How I can filter this line chart correctly

I'm working on a project. I had a correction that the line graph at the bottom should only reflect years. But, when applying a filter by years, show me each month of that year in that graph. Do they have any recommendations?

4 Replies

  • Hi Syndicate_Admin ,

    Instead of using date hierarchy, create a new year date column in your calendar table using the bellow code:

    Year = FORMAT(Calendario[Date],"yyyy")

     make sure thatt the data type is set to whole number:

     

    Now place this new created column under X-axis and remove the date column in x-axis.

    • Syndicate_Admin's avatar
      Syndicate_Admin
      Icon for Administrator rankAdministrator

      The drawback is that, when I apply the date filter, it only shows me one point on the graph, corresponding to that year. As directed, it should show every month of that year. I attach what it shows me when filtering a specific year using the predicted risk filter.

      • Bibiano_Geraldo's avatar
        Bibiano_Geraldo
        Icon for Super User rankSuper User

        Understood, in this case with your original date hierarchy, you will have to drill down when the year is selected.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Syndicate_Admin ,

    Based on your description, first use the date hierarchy as your x-axis, then you can use the Expand All Fields at Once feature in the drill-down function, and finally select the year you need on your filter

    Drill mode in the Power BI service - Power BI | Microsoft Learn

     

    Best regards,
    Albert He


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