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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
L_K_
Helper I
Helper I

Selected value in slicer should affect only part of the measure

Hello,

I really need some help with an idea I’m having.

 

Let's say I have a table like this:

Name_ID

Value_1

Measure

100

140.000

 

101

30.000

 

130

16.000

 

Total

186.000

 

 

I also made a table for calculating percentages in a way that, if I want to pick a percentage in a slicer, then the measure calculates the name_ID value (Value_1) with Value_2.

Name_displayed_in_slicer

Value_2

2%

1,02

5%

1,05

8%

1,08

 

I have a measure for the percentage values:

Sum_Value_2 = calculate(sum(table[Value_2]))

 

and then a measure that calculates (multiplies) the name_ID values (Value_1) with Value_2:

Measure  = Sum_Value_2 * Value_1

 

So now when I pick let's say 5% in the slicer, the values (Value_1) from name_ID will multiply by 1,05 (Value_2) so I get new values that are higher for 5% in the column for measure. The measure values are as seen in the next table:

Name_ID

Value

Measure

100

140.000

147.000

101

30.000

31.500

130

16.000

16.800

Total

186.000

195.300

 

Now to finally get to my problem.

I would like to add a slicer that when I pick a name_ID only that value multiplies by the selected value from the first slicer and others stay the same.

 

So, if I pick 5% in the first slicer and the name_ID 100 from the second slicer,

the result would be as seen in the next table:

Name_ID

Value

Measure

100

140.000

147.000

101

30.000

30.000

130

16.000

16.000

Total

186.000

193.000

 

How do I write a DAX formula that would make this possible? And then the total value to be correct as well?

 

A big thank you in advance!

1 ACCEPTED SOLUTION
PaulOlding
Solution Sage
Solution Sage

Hi @L_K_ 

This solution uses a disconnected table called Names that just contains all the Name_ID values, and that is used in the Name_ID slicer.

I have a Percentages table that looks like this, so Multiplier is the equivalent of your Value_2:

PaulOlding_0-1654085254853.png

 

The Measure is

Measure = 
VAR _Multiplier = SELECTEDVALUE(Percentages[Multiplier])
VAR _SelectedNameIDs = VALUES(Names[Name_ID])
VAR _WithMultiplier = 
SUMX(
    'Table',
    VAR _IsSelectedName = 'Table'[Name_ID] IN (_SelectedNameIDs)
    RETURN
        'Table'[Value] * _Multiplier * _IsSelectedName
)
VAR _WithoutMultiplier = 
SUMX(
    'Table',
    VAR _NotIsSelectedName = NOT('Table'[Name_ID] IN (_SelectedNameIDs))
    RETURN
        'Table'[Value] * _NotIsSelectedName
)
RETURN
    _WithMultiplier + _WithoutMultiplier

The _IsSelectedName and _NotIsSelectedName are true/false.  When you multiply by true/false DAX will treat true as 1 and false as 0.  So, if the Name_ID has been selected in the slicer it will return:

  • Value * Multiplier for _WithMultiplier
  • 0 for _WithoutMultiplier (as we multiply by false, and false is 0)

Final result

PaulOlding_1-1654085654553.png

 

View solution in original post

2 REPLIES 2
L_K_
Helper I
Helper I

Hello @PaulOlding,

 

It took me some time to figure this out on my real data, but I eventually got it right and it works perfectly!

 

Thank you so much! 

PaulOlding
Solution Sage
Solution Sage

Hi @L_K_ 

This solution uses a disconnected table called Names that just contains all the Name_ID values, and that is used in the Name_ID slicer.

I have a Percentages table that looks like this, so Multiplier is the equivalent of your Value_2:

PaulOlding_0-1654085254853.png

 

The Measure is

Measure = 
VAR _Multiplier = SELECTEDVALUE(Percentages[Multiplier])
VAR _SelectedNameIDs = VALUES(Names[Name_ID])
VAR _WithMultiplier = 
SUMX(
    'Table',
    VAR _IsSelectedName = 'Table'[Name_ID] IN (_SelectedNameIDs)
    RETURN
        'Table'[Value] * _Multiplier * _IsSelectedName
)
VAR _WithoutMultiplier = 
SUMX(
    'Table',
    VAR _NotIsSelectedName = NOT('Table'[Name_ID] IN (_SelectedNameIDs))
    RETURN
        'Table'[Value] * _NotIsSelectedName
)
RETURN
    _WithMultiplier + _WithoutMultiplier

The _IsSelectedName and _NotIsSelectedName are true/false.  When you multiply by true/false DAX will treat true as 1 and false as 0.  So, if the Name_ID has been selected in the slicer it will return:

  • Value * Multiplier for _WithMultiplier
  • 0 for _WithoutMultiplier (as we multiply by false, and false is 0)

Final result

PaulOlding_1-1654085654553.png

 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.