Forum Discussion

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

Show different data according to filter in the same graph?

Hello, I have the following question, I don't know if it will be possible to do it.

I have a graph, and 3 types of data of the same items, for example, I have apples and banana, I need to be able to show apple data in kilos, dollars, and quantity.

So far I have 3 different graphs showing the information, (one graph for kilos, another for dollars and another for the amount of apples and bananas), but that makes me have 3 different pages with information, is it possible that through a filter I can select the information I need?

For example, a filter that contains kilos, dollars and quantity, when you click on kilos it shows the graph in kilos, when you click on dollars it changes the same graph and shows dollars.

Best regards

  • Hello, it finally worked, I made a few mistakes in the measurements, but that was the key.

    Thanks a lot!

    Best regards

9 Replies

  • saud968's avatar
    saud968
    Icon for Memorable Member rankMemorable Member

    Yes, it's possible to achieve this in Power BI by using a slicer to filter the data displayed in a single graph. Here's how you can do it:

    Create a Data Table: First, create a table that includes your items (apples, bananas) and their corresponding data in kilos, dollars, and quantity.

    Unpivot Your Data: In Power Query, unpivot your data so that you have a column for the item, a column for the type of data (kilos, dollars, quantity), and a column for the values.

    Create a Slicer: Add a slicer to your report and set it to filter by the type of data (kilos, dollars, quantity).

    Create a Single Graph: Create a graph that displays the items and their values. Use the slicer to filter the data shown in the graph.

    Here's a step-by-step guide:

    Load Your Data:

    Load your data into Power BI.
    Ensure your data includes columns for items, kilos, dollars, and quantity.
    Transform Your Data:

    Go to Power Query Editor.
    Select the columns for kilos, dollars, and quantity.
    Right-click and choose "Unpivot Columns".
    This will create a new column for the type of data and another for the values.
    Create a Slicer:

    Go back to your report view.
    Add a slicer visual to your report.
    Drag the "Type of Data" column to the slicer.
    Create the Graph:

    Add a graph visual to your report.
    Drag the "Item" column to the axis.
    Drag the "Values" column to the values field.
    Use the slicer to filter the data displayed in the graph.
    This way, you can switch between kilos, dollars, and quantity in the same graph using the slicer. This approach will help you keep your report clean and interactive. If you need more detailed steps or run into any issues, feel free to ask!

    Best Regards
    Saud Ansari
    If this post helps, please Accept it as a Solution to help other members find it. I appreciate your Kudos!

  • You could create a field parameter and choose the kilo, $ and amount measures as the members of the field parameter. Then add the field parameter to your chart instead of the individual measures, and the user can choose from the slicer which they want to show.

    • Syndicate_Admin's avatar
      Syndicate_Admin
      Icon for Administrator rankAdministrator

      Thank you very much, I am trying this solution, when adding the field parameter to the graph and formatting it only gives me the option of counting and distinctive counting, I can't get it to give me the option of sum, how could it be done?


      Best regards

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

        When you create the field parameter you need to use measure, not columns. You can apply format strings to the measures and that should then be applied in the visual when you use the field parameter.