Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. 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:
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
87 | |
85 | |
82 | |
66 | |
49 |
User | Count |
---|---|
137 | |
111 | |
101 | |
66 | |
65 |