Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi!
I need a line chart that only shows filtered data. User could use a filter and select the data they want to be seen in the line chart.
Here is my data (excel):
Here is the line chart:
Here is the filter - how should I build it?
Many thanks!
Tuomo, Finland
Solved! Go to Solution.
Hi @nTuomo ,
I suggest you to create a Dim column header table to help calculation.
Dim data column header =
DATATABLE(
"data column",STRING,
"Order",INTEGER,
{
{"data 1",1},
{"data 2",2},
{"data 3",3},
{"data 4",4},
{"data 5",5}
}
)
Measure:
Measure =
VAR _data1 = SUM('Table'[data 1])
VAR _data2 = SUM('Table'[data 2])
VAR _data3 = SUM('Table'[data 3])
VAR _data4 = SUM('Table'[data 4])
VAR _data5 = SUM('Table'[data 5])
RETURN
SWITCH(SELECTEDVALUE('Dim data column header'[Order]),1,_data1,2,_data2,3,_data3,4,_data4,5,_data5)
Result is as below.
Or you can Unpivot other columns by [year] in Power Query Editor to do some transformation on your table.
Then it will be easier to achieve your goal, you can add [Value] in Y axis and [Attribute] in Legend.
For reference: Unpivot columns - Power Query | Microsoft Learn
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@saipranay Thank you for the reply!
But how could I get the filter to work so that user can select, which data is visible on line chart?
Selection should be between Data 1 / Data 2 / Data 3 ... etc
Not the way it is now (2 / 8 / 9 etc...) :
Hi @nTuomo ,
I suggest you to create a Dim column header table to help calculation.
Dim data column header =
DATATABLE(
"data column",STRING,
"Order",INTEGER,
{
{"data 1",1},
{"data 2",2},
{"data 3",3},
{"data 4",4},
{"data 5",5}
}
)
Measure:
Measure =
VAR _data1 = SUM('Table'[data 1])
VAR _data2 = SUM('Table'[data 2])
VAR _data3 = SUM('Table'[data 3])
VAR _data4 = SUM('Table'[data 4])
VAR _data5 = SUM('Table'[data 5])
RETURN
SWITCH(SELECTEDVALUE('Dim data column header'[Order]),1,_data1,2,_data2,3,_data3,4,_data4,5,_data5)
Result is as below.
Or you can Unpivot other columns by [year] in Power Query Editor to do some transformation on your table.
Then it will be easier to achieve your goal, you can add [Value] in Y axis and [Attribute] in Legend.
For reference: Unpivot columns - Power Query | Microsoft Learn
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello @nTuomo ,
As per your stated question, In Visualization tab we can use slicer visual to get the functionality you are looking for.
Use this as a visual for your report buliding.
By following above steps you can get our fliter option which you are looking for.
For addition help:
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
81 | |
76 | |
61 | |
37 | |
33 |
User | Count |
---|---|
99 | |
56 | |
50 | |
42 | |
40 |