Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
mj2024
Helper I
Helper I

how to display multiple data series on one chart controlled by a slicer?

Hi

I have 3 separate data sources (using DirectQuery) that I want to plot on the same chart.  I am using a bar chart.  I would like to have a slicer that lets me select which series to display.  If I pick data source 1 on the slicer then data source 1 is displayed.  If I pick data source 2 on the slicer then data source 2 is displated.  How can I do this? 

Thank you

1 ACCEPTED SOLUTION
Kedar_Pande
Community Champion
Community Champion

@mj2024 

Create a table with the names of your data sources

DataSourceSelector = 
DATATABLE(
"DataSource", STRING,
{
{"Data Source 1"},
{"Data Source 2"},
{"Data Source 3"}
}
)

Create a measure

SelectedData = 
SWITCH(
SELECTEDVALUE(DataSourceSelector[DataSource]),
"Data Source 1", SUM('DataSource1'[Value]),
"Data Source 2", SUM('DataSource2'[Value]),
"Data Source 3", SUM('DataSource3'[Value]),
BLANK()
)

Add the shared axis (e.g., Date or Category) to the X-axis.
Add the SelectedData measure to the Y-axis.

Use the DataSourceSelector table as a slicer. When you select a data source in the slicer, the SelectedData measure dynamically adjusts to display data from the corresponding data source.

 

💌 If this helped, a Kudos 👍 or Solution mark would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn

View solution in original post

7 REPLIES 7
Kedar_Pande
Community Champion
Community Champion

@mj2024 

Create a table with the names of your data sources

DataSourceSelector = 
DATATABLE(
"DataSource", STRING,
{
{"Data Source 1"},
{"Data Source 2"},
{"Data Source 3"}
}
)

Create a measure

SelectedData = 
SWITCH(
SELECTEDVALUE(DataSourceSelector[DataSource]),
"Data Source 1", SUM('DataSource1'[Value]),
"Data Source 2", SUM('DataSource2'[Value]),
"Data Source 3", SUM('DataSource3'[Value]),
BLANK()
)

Add the shared axis (e.g., Date or Category) to the X-axis.
Add the SelectedData measure to the Y-axis.

Use the DataSourceSelector table as a slicer. When you select a data source in the slicer, the SelectedData measure dynamically adjusts to display data from the corresponding data source.

 

💌 If this helped, a Kudos 👍 or Solution mark would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn

Hi @Kedar_Pande 

This works!  Thank you!

 

Hi @mj2024 ,

 

Thanks for your feedback.

 

Adamk Kong

v-kongfanf-msft
Community Support
Community Support

Hi @mj2024 ,

 

As Ibenllin said, field parameters are a good choice. Refer to the demo below:

vkongfanfmsft_1-1735009416952.pngvkongfanfmsft_2-1735009438968.pngvkongfanfmsft_3-1735009448743.pngvkongfanfmsft_4-1735009456644.png

For more details, you can refer to below bolg:

Power BI Field Parameters: What Are They & How to Use Them?| Coupler.io Blog

 

Best Regards,
Adamk Kong

 

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

lbendlin
Super User
Super User

You do that with Field Parameters.

do you have a resource that shows how to do it?

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.