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
donaldo
Helper III
Helper III

Apply % increase / decrease to all numbers in visual based on a column value

Hey all,

 

I'm creating a dashboard summarizing the values of a bunch of projects in different way.

 

Projects are on stages 1-5 according to how far along they are. Their value is budgeted with a % of estimated value based on how far along (likely) they are. So projects at stage 1 have an estimated value of 100, but only 20% of it is expected to take fail rates into account etc. So I would like to create a filter or something similiar that can filter the values of the the entire visual according to their stage, but also show the unconstrained values. Like an on/off.

 

ProjectStageValueDepartment
A1100X
B2100Z
C3100Y
D4100X
E5100Z

 

StageBudget %
110
220
350
470
590

 

What can I do to show the same visuals but with the different values with a toggle of sorts, filter or button?

 

1 ACCEPTED SOLUTION

@donaldo

Just as indicated previously.  If you want the unconstrained version if no selection:

 

Measure =
SWITCH (
    SELECTEDVALUE ( 'Confidence Toggle'[Constrained / Unconstrained] );
    "Constrained"; CALCULATE ( SUM ( Idea[Total Savings Constrained] ) );
    "Unconstrained"; CALCULATE ( SUM ( Idea[Current Savings] ) );
    CALCULATE ( SUM ( Idea[Current Savings] ) )
)

 

Although you can actually simplify the code a bit like this:

 

Measure =
SWITCH (
    SELECTEDVALUE ( 'Confidence Toggle'[Constrained / Unconstrained] );
    "Constrained"; CALCULATE ( SUM ( Idea[Total Savings Constrained] ) );
    CALCULATE ( SUM ( Idea[Current Savings] ) )
)

Note that this will show the Constrained version only when only "Constrained" is selected. In all other cases, it will show the Unconstrained version. 

 

 

View solution in original post

6 REPLIES 6
AlB
Super User
Super User

Hi @donaldo

 

I do not quite understand what values you would want to show in both cases. Can you explain it a bit more, showing an example based on your sample data?

hi  @AlB

 

Thanks for the quick reply.


I've made various charts with the projects depicting their value based on department, date dimensions etc.

 

I would like to see the very same charts with their value both with and without their % value deductions.

 

So right now they are all showing the full value, but I would like a toggle so the value of projects at stage 1 only show 10%, stage 2 at 20% and so on. 

@donaldo

You could create a new one-column table Toggle[Toggle] with values ON and OFF (or any other of your liking) and  place it on a slicer. Then create another measure that will do one calculation or the other based on the value of the toggle, which you can harvest through SELECTEDVALUE( 😞

 

 

Measure =
SWITCH (
    SELECTEDVALUE ( Toggle[Toggle] ),
    "ON", Write here your code for the ON option ,
    "OFF", Write here your code for the OFF option ,
    Write here your code for what you want with nothing or both options are selected in the slicer
)

 

There might be a fancier visual for the slicer with button shape or similar. Not sure.  

 

Hi @AlB

 

I've gotten this far, but having trouble setting the ELSE to be same same as the 2nd option. "Unconstrained" which sort of is the defualt view.


How do I wrap up my code (I'm guessing ELSE) so that it will still show values (Unconstrained) if no toggle is selected?

Measure = 
SWITCH (
    SELECTEDVALUE('Confidence Toggle'[Constrained / Unconstrained]);
    "Constrained"; CALCULATE(SUM(Idea[Total Savings Constrained]));
    "Unconstrained";CALCULATE(SUM(Idea[Current Savings]));

@donaldo

Just as indicated previously.  If you want the unconstrained version if no selection:

 

Measure =
SWITCH (
    SELECTEDVALUE ( 'Confidence Toggle'[Constrained / Unconstrained] );
    "Constrained"; CALCULATE ( SUM ( Idea[Total Savings Constrained] ) );
    "Unconstrained"; CALCULATE ( SUM ( Idea[Current Savings] ) );
    CALCULATE ( SUM ( Idea[Current Savings] ) )
)

 

Although you can actually simplify the code a bit like this:

 

Measure =
SWITCH (
    SELECTEDVALUE ( 'Confidence Toggle'[Constrained / Unconstrained] );
    "Constrained"; CALCULATE ( SUM ( Idea[Total Savings Constrained] ) );
    CALCULATE ( SUM ( Idea[Current Savings] ) )
)

Note that this will show the Constrained version only when only "Constrained" is selected. In all other cases, it will show the Unconstrained version. 

 

 

Hi @AlB

 

Thanks for the suggestion. I would be okay with a slider option.

 

I will go ahead and try this solution. 

Will report back.

 

Thank you for your help.

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.