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
Fabio_B
Frequent Visitor

Simple column filter

Hello all,

this is my very first post, so nice to meet you all.
I'm approaching Power Bi since a while, but still struggling with this filter.
I have an excel file like this:

Excel_Energy.PNG

 

What i would like to achieve is a drop down filter that filters the column of the table above, in order to select only the data that I need (basically energy or gas country related) and to show it in a simple chart.

I've tried to look on-line but still not able to achieve it.
Can someone please help me to understand how to fix this?
Many thanks in advance for your kind support.


BR


Fabio

1 ACCEPTED SOLUTION
v-heq-msft
Community Support
Community Support

Hi @Fabio_B ,
Thanks to @quantumudit and @Greg_Deckler  previous quality answers, here's my solution to your new question
Here some steps that I want to share, you can check them if they suitable for your requirement.
Here is my test data:

vheqmsft_0-1713167557948.png
Following the previous steps I accomplished the following effect

vheqmsft_1-1713167642925.png

In order to add or remove line segments automatically, you can create a meaure and use filed parameter to achieve this effect.
Create meaures

Sum of FRANCE GAS = SUM('Table'[FRANCE GAS])
Sum of FRANCE Power = SUM('Table'[FRANCE Power])
Sum of ITALY GAS = SUM('Table'[FRANCE GAS])
Sum of ITALY Power = SUM('Table'[ITALY Power])

Based on these meaure to create filed parameter
In order to realize the use of a filed parameter to control two different visual objects, first you need to make sure that the order of the two parameters is the same, and second you need to create a one-to-one relationship between the two parameters based on the Parameter order

vheqmsft_2-1713168336715.png

vheqmsft_3-1713168343708.png

vheqmsft_4-1713168362111.png

Final outputt

vheqmsft_5-1713168410065.png

vheqmsft_6-1713168451002.png

 

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

 

 



 



 

View solution in original post

4 REPLIES 4
v-heq-msft
Community Support
Community Support

Hi @Fabio_B ,
Thanks to @quantumudit and @Greg_Deckler  previous quality answers, here's my solution to your new question
Here some steps that I want to share, you can check them if they suitable for your requirement.
Here is my test data:

vheqmsft_0-1713167557948.png
Following the previous steps I accomplished the following effect

vheqmsft_1-1713167642925.png

In order to add or remove line segments automatically, you can create a meaure and use filed parameter to achieve this effect.
Create meaures

Sum of FRANCE GAS = SUM('Table'[FRANCE GAS])
Sum of FRANCE Power = SUM('Table'[FRANCE Power])
Sum of ITALY GAS = SUM('Table'[FRANCE GAS])
Sum of ITALY Power = SUM('Table'[ITALY Power])

Based on these meaure to create filed parameter
In order to realize the use of a filed parameter to control two different visual objects, first you need to make sure that the order of the two parameters is the same, and second you need to create a one-to-one relationship between the two parameters based on the Parameter order

vheqmsft_2-1713168336715.png

vheqmsft_3-1713168343708.png

vheqmsft_4-1713168362111.png

Final outputt

vheqmsft_5-1713168410065.png

vheqmsft_6-1713168451002.png

 

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

 

 



 



 

quantumudit
Continued Contributor
Continued Contributor

Hello @Fabio_B 

 

Welcome to the community, You need to do the following steps:

 

PowerQuery Steps

  • Keeping the "Month-Year" column unpivot the rest of the columns,i.e., the "Country Metric" column. You'll end up with 3 columns, i.e., "Month-Year", "metric," and "value."
  • Now, Split the "metric" column by space delimiter and you'll get the "Country" and "Metric" columns separately
  • Similarly, split the "Month-Year" column by "-" delimiter and you will end up with the "Month" and "Year" columns
  • Trim for any whitespace in columns and other unnecessary columns, and provide appropriate datatype
  • You will eventually end up with a dataset with the following columns:
    • Month
    • Year
    • Country
    • Metric
    • Value

Power BI

  • Load the dataset, and provide the "Metric" column as a dropdown slicer (It should contain Power/Gas value)
  • You can any chart or, table to dynamically visualize the result

 

Hope these steps will help you solve the issue, but let us know if the issue persists.

 

Best Regards,
Udit

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudo 👍

🚀 Let's Connect: LinkedIn || YouTube || Medium || GitHub
Visit My Linktree: LinkTree

Thanks for your quick reply @quantumudit  and @Greg_Deckler !
I've solved this issue creating a field (New parameter, Fields) with the column that i was looking for.

Now i'm able to filter by year (month, quarter etc...) and also by Country of interest:

 

Energy _ Draft.PNG

I was thinking it was ok but i'm struggling now to create a responsive chart, linked to the table above.
The table is created like this:

Table.PNG
I would like to achieve a line chart, that will automatically add and remove lines according to the filter selected, as well as per adjusting itself according to the timing selected.
Do you think is something feasible?


Thanks again for any feedback you will share.

 

Fabio

Greg_Deckler
Super User
Super User

@Fabio_B Right, so you need to use a Slicer (it's the visual usually two rows up from the bottom that has a funnel in the icon). You can switch it from list mode (default) to a dropdown.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.