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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
PBI_newuser
Post Prodigy
Post Prodigy

Slicer for all products

Hi,

I received a table from a customer.

I need to create a line chart in the report.

How to have a slicer with only Product A,B and C and when users didn't select any slicer, it shows the "All" product line chart?

 

ProductOct-19Nov-19Dec-19Jan-20Feb-20Mar-20Apr-20May-20Jun-20Jul-20Aug-20Sep-20
All0.00%3.30%4.43%7.46%8.34%7.53%6.40%7.16%6.37%6.05%5.50%5.57%
Product A0.00%6.45%6.45%8.06%7.74%7.49%6.38%7.11%6.32%5.68%5.17%5.26%
Product B0.00%0.00%2.53%5.70%9.11%7.79%6.64%7.84%6.97%7.06%6.42%6.54%
Product C0.00%0.00%0.00%10.00%8.00%6.50%5.40%4.70%4.20%3.80%3.40%3.10%
1 ACCEPTED SOLUTION
v-robertq-msft
Community Support
Community Support

Hi, @PBI_newuser 

According to your description, you can try my steps:

  1. Go to power query editor, do some transformation:

v-robertq-msft_0-1605162999358.png

屏幕截图 2020-11-12 143717.png

 

  1. Create a new table[Slicer], like this:

v-robertq-msft_2-1605162999400.png

 

  1. Create a measure:
Measure =
IF(
    ISFILTERED(Slicer[Name]),
    SWITCH(
        SELECTEDVALUE(Slicer[Name]),
        "Product A",CALCULATE(MAX([Value]),FILTER('Table',[Product]="Product A")),
        "Product B",CALCULATE(MAX([Value]),FILTER('Table',[Product]="Product B")),
        "Product C",CALCULATE(MAX([Value]),FILTER('Table',[Product]="Product C"))),
CALCULATE(MAX([Value]),FILTER('Table',[Product]="All")))

 

  1. Create a line chart and place columns and measure, like this:

屏幕截图 2020-11-12 143737.png

And you can get what you want.

You can download my test pbix file here

 

Best Regards,

Community Support Team _Robert Qin

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

2 REPLIES 2
v-robertq-msft
Community Support
Community Support

Hi, @PBI_newuser 

According to your description, you can try my steps:

  1. Go to power query editor, do some transformation:

v-robertq-msft_0-1605162999358.png

屏幕截图 2020-11-12 143717.png

 

  1. Create a new table[Slicer], like this:

v-robertq-msft_2-1605162999400.png

 

  1. Create a measure:
Measure =
IF(
    ISFILTERED(Slicer[Name]),
    SWITCH(
        SELECTEDVALUE(Slicer[Name]),
        "Product A",CALCULATE(MAX([Value]),FILTER('Table',[Product]="Product A")),
        "Product B",CALCULATE(MAX([Value]),FILTER('Table',[Product]="Product B")),
        "Product C",CALCULATE(MAX([Value]),FILTER('Table',[Product]="Product C"))),
CALCULATE(MAX([Value]),FILTER('Table',[Product]="All")))

 

  1. Create a line chart and place columns and measure, like this:

屏幕截图 2020-11-12 143737.png

And you can get what you want.

You can download my test pbix file here

 

Best Regards,

Community Support Team _Robert Qin

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

amitchandak
Super User
Super User

@PBI_newuser , I think for that you need to use buttons and bookmarks, Have a button to show all and other to select a product https://radacad.com/bookmarks-and-buttons-making-power-bi-charts-even-more-interactive

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.