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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.