cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
NoaB Frequent Visitor
Frequent Visitor

Change horizontal/constant line based on slicer selection

Hi,

 

Is there a way to change the constant line based off the slicer selection? I have a slicer with four different options and each of them have different capacities. Is there a way for a constant horizontal line to change based off the slicer selection wihtout having to manually insert the capacities in the table.

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Change horizontal/constant line based on slicer selection

Hi @NoaB ,

 

You need to add a measure that makes the calculation for each of your option on the slicer, something like this:

 

Flat Line =
SWITCH (
    SELECTEDVALUE ( Table2[Capacity] );
    "A"; 20;
    "B"; 25;
    "C"; 5;
    "D"; 40;
    80
)

This needs to be adjusted to your needs but as you can see below the numbers change accordingly

 

FlatLine.gif

 

Regards,

MFelix



Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!




View solution in original post

6 REPLIES 6
Super User
Super User

Re: Change horizontal/constant line based on slicer selection

Hi @NoaB ,

 

You need to add a measure that makes the calculation for each of your option on the slicer, something like this:

 

Flat Line =
SWITCH (
    SELECTEDVALUE ( Table2[Capacity] );
    "A"; 20;
    "B"; 25;
    "C"; 5;
    "D"; 40;
    80
)

This needs to be adjusted to your needs but as you can see below the numbers change accordingly

 

FlatLine.gif

 

Regards,

MFelix



Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!




View solution in original post

NoaB Frequent Visitor
Frequent Visitor

Re: Change horizontal/constant line based on slicer selection

Hi @MFelix ! Thanks for your response!

 

I tried your approach and I'm still having some issues. Is Table2[Capacity] the table that has a column "Capacity" which results in the options for the slicer?

 

I attempted thios measure below and was receiving an error "Unexpected expression" for everything starting after the semicolon after "SELECTEDVALUE( HourlyCapacityWithETA[PoolName] );" 

 

Flat Line =
SWITCH(
SELECTEDVALUE( HourlyCapacityWithETA[PoolName] );
"Var1"; 220;
"Var2"; 220;
"Var3"; 70;
"Var4"; 364;
)
 
Thanks for your help!
Super User
Super User

Re: Change horizontal/constant line based on slicer selection

Hi @NoaB ,

 

This as to do with regional settings, on some systems it uses the dot comma on other only comma.

 

Redo your measure to:

 

Flat Line =
SWITCH(
SELECTEDVALUE( HourlyCapacityWithETA[PoolName] ),
"Var1", 220,
"Var2", 220,
"Var3", 70,
"Var4", 364
)

Regards,

MFelix



Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!




NoaB Frequent Visitor
Frequent Visitor

Re: Change horizontal/constant line based on slicer selection

Amazing! Thank you @MFelix !

 

Do you know if there is a way to send an alert for static data when the data crossed the capacity line? 

Super User
Super User

Re: Change horizontal/constant line based on slicer selection

Hi @NoaB ,

 

Can you elaborate on your question please? What do you mean to send out an alert?

 

Regards,

MFelix



Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!




NoaB Frequent Visitor
Frequent Visitor

Re: Change horizontal/constant line based on slicer selection

Hi @MFelix ,

 

I've been looking into Power BI's functionality for sending out alerts. However it only works for livestream data for KPIs and gauges visuals. I was wondering if there functionality for a static data set that if the graph reaches a certain threshold a notification can appear.

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 311 members 3,302 guests
Please welcome our newest community members: