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
shikhavidyarthi
Frequent Visitor

Show/Hide Columns in Line Chart Visuals with Multiselect Slicer in Power BI #Line Chart, # Slicers,

I have a line chart with 4 columns added like below. My X -axis is operating_dates.

shikhavidyarthi_0-1675983215870.png

Now the users feel that lines seem to be crowded sometimes. Do we have an option to select two/three lines only at a time.

 

I tried creating this but I am able to select only one line at a time by using below steps.
Created a new table as slicer table:

shikhavidyarthi_1-1675983349133.png

Then create a measure as user selection:

User Selection = SELECTEDVALUE('Slicer Table'[Value])
Create a new measure:
calculation =
SWITCH(
    TRUE(),
    [User Selection] = "Act_Pkgs", sum(Data[act_pkgs]),
    [User Selection] = "EDP_Pkgs", sum(Data[edp_pkgs]),
    [User Selection] = "NOP_Pkgs", sum(Data[nop_pkgs]),
    [User Selection] = "Prev_Yr_Act_Pkgs", sum(Data[prev_yr_act_pkgs]),
    "Select any Calc"
    )
 
This way I can select only single calculation at a time. If I try to select two its displaying as blank because I am asking for two different calculation at a time.
shikhavidyarthi_2-1675983543757.png

I want two or three lines to select with color coding.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@shikhavidyarthi , Use field parameters

Power BI Field Parameters — A Quick way for Dynamic Visuals: https://amitchandak.medium.com/power-bi-field-parameters-a-quick-way-for-dynamic-visuals-fc4095ae9af...
Power BI Field Parameters- Measure Slicer and Axis/Dimension slicer: https://youtu.be/lqF3Wa1FllE
Switch TOPN with Field Parameters: https://amitchandak.medium.com/switch-topn-with-field-parameters-299a0ae3725f
Field Parameters- Conditional Formatting
: https://amitchandak.medium.com/field-parameters-conditional-formatting-517aacc23fdf

View solution in original post

2 REPLIES 2
Belin
Frequent Visitor

Check this out

 

https://sqlskull.com/2020/10/17/show-hide-measures-in-line-chart-visuals-using-slicer-in-power-bi/

 

don't require any preview item and it's a clever solution that allow for even more customization

This was my variation for multiselect:

1)create a table called Slicer, with one column
Filtered_values

line1

line2

line3

2) create a measure like this

The_measure_as_line_to_hide_show =
IF(
    CONTAINSSTRING(ALLSELECTED(Slicer[Filtered_values]), "line1"),
    "My calculated measure",
    ""
)
3)do the same for line2 and line3
4)put a slicer in the report with the Filtered_values column
5)set the slicer to filter only that chart
amitchandak
Super User
Super User

@shikhavidyarthi , Use field parameters

Power BI Field Parameters — A Quick way for Dynamic Visuals: https://amitchandak.medium.com/power-bi-field-parameters-a-quick-way-for-dynamic-visuals-fc4095ae9af...
Power BI Field Parameters- Measure Slicer and Axis/Dimension slicer: https://youtu.be/lqF3Wa1FllE
Switch TOPN with Field Parameters: https://amitchandak.medium.com/switch-topn-with-field-parameters-299a0ae3725f
Field Parameters- Conditional Formatting
: https://amitchandak.medium.com/field-parameters-conditional-formatting-517aacc23fdf

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.