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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
IF
Post Prodigy
Post Prodigy

SELECTEDVALUE with Slicer Selection

Hi,

have the following data:

Slider1

Slider2

Date

Value

DateFormated

#

A

07.2020

12

1/7/2020

#

B

07.2020

14

1/7/2020

C1

A

07.2020

21

1/7/2020

C2

A

07.2020

23

1/7/2020

D1

B

07.2020

32

1/7/2020

D2

B

07.2020

34

1/7/2020

#

A

08.2020

42

1/8/2020

#

B

08.2020

44

1/8/2020

C1

A

08.2020

55

1/8/2020

C2

A

08.2020

35

1/8/2020

D1

B

08.2020

46

1/8/2020

D2

B

08.2020

65

1/8/2020

#

A

11.2019

77

1/11/2019

#

B

11.2019

76

1/11/2019

C1

A

11.2019

54

1/11/2019

C2

A

11.2019

66

1/11/2019

D1

B

11.2019

56

1/11/2019

D2

B

11.2019

67

1/11/2019

 

I use the measure: ValueMeasure = CALCULATE(SUM('Table'[Value]),'Table'[Slider1]="#")

If I select A or B value at slider2, I get the right result.

 

However, I get wrong result if I select slicer1 value. For example I should get 55, but it shows 86. So I want to have a better measure that works for both slicers.

 

2.jpg

 

I hope it is clearly explained.

Thanks in advance!

1 ACCEPTED SOLUTION
lkalawski
Memorable Member
Memorable Member

Hi @IF

Ok, I didn't understand you well last time.
You have two solutions:
1. Create one additional Slider column based on slider1 and slider2. (If slider1 = #, take slider2, otherwise slider1).
Add a new column as a slider and use it for filtering.

2. Create a measure:

ValueMeasure = 
VAR _slider1 = SELECTEDVALUE('Table'[Slider1])

RETURN
IF(ISFILTERED('Table'[Slider1]),
CALCULATE(Sum('Table'[Value]), All('Table'[Slider2])),
CALCULATE(Sum('Table'[Value]), FILTER('Table', 'Table'[Slider1] = "#"))
)

 



_______________
If I helped, please accept the solution and give kudos! 😀

View solution in original post

14 REPLIES 14
KikiB
New Member

I have created slicers from a table of measures. 

 

I need help with my selected measureshowing the data rather than the name, is this possible?

KikiB_0-1607515789632.png

 

i want the card showing Age 31-35 to show the value e.g. 35 instead of the name of the measure. 

 

thank you

I would do another column and replace the data. In this case I would replace "Age 31-35" with "35". You can also change the column for the slicer to display the new column.

lkalawski
Memorable Member
Memorable Member

Hi @IF

Why do you use the condition 'Table' [Slider1] = "#" in the measure? 

When using such a condition, you cannot use Slicer1 because the measure will always calculate for "#".
If you want to dynamically change slicers and show the total, you just need to create a measure SUM ('Table' [Value]) and the values will change dynamically.

Examples:

lkalawski_0-1599738046218.pnglkalawski_0-1599738242322.png

 

If you want to include the date as well as a filter, add another slicer or add condition to the measure.



_______________
If I helped, please accept the solution and give kudos! 😀

 

 

Hi,

If I delete the part: Table'[Slider1]="#" then, I don't get result for other slicer.

 
All the best
Greg_Deckler
Super User
Super User

@IF I mocked this up in a PBIX, can you confirm that I did it correctly? Your measure is going to calculate the SUM for # rows always the way it is written.  See PBIX below sig. It is odd that the slicer does not seem to be impacting the card visual though.

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Hi, It is not working for slicer one 😞

lkalawski
Memorable Member
Memorable Member

Hi @IF,

Can you share your pbix file?

If A (07.2020) is selected I want to see value:12 . If C1 is selected, I want to see value 21.

lkalawski
Memorable Member
Memorable Member

@IF ,

 

Please use this file: https://gofile.io/d/4Szfws

You had an issue in the measure code.

 



_______________
If I helped, please accept the solution and give kudos! 😀

Hi,

I checked the file but it gives wrong number with A value. It should be 12 for 07.2020 but it shows 56. It sums all but, it is not helpful.

All the best

 

 

lkalawski
Memorable Member
Memorable Member

Hi @IF

Ok, I didn't understand you well last time.
You have two solutions:
1. Create one additional Slider column based on slider1 and slider2. (If slider1 = #, take slider2, otherwise slider1).
Add a new column as a slider and use it for filtering.

2. Create a measure:

ValueMeasure = 
VAR _slider1 = SELECTEDVALUE('Table'[Slider1])

RETURN
IF(ISFILTERED('Table'[Slider1]),
CALCULATE(Sum('Table'[Value]), All('Table'[Slider2])),
CALCULATE(Sum('Table'[Value]), FILTER('Table', 'Table'[Slider1] = "#"))
)

 



_______________
If I helped, please accept the solution and give kudos! 😀

Hi,

Thanks a lot. The second way works for me. I already accepted the solution. ps. The only problems is that if I select two from slicer2, I would like to get either total or n/a, etc. 🙂

All the best

Hi,

Thanks for the support. However, this is not working. It shows the same value if I select C1, C2, etc.

All the best

Ismail

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.