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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
newlearn123
New Member

dynamic tooltips with parameter

Hello to all,

 

I have created a parameter to use as a filter: Parameter_Slicer with A, B, C as dropdown list  to select from.

 

A, B, C are employee names and they have attributes (in the same table), for example are numbers: A_Number, B_Number and C_Number

 

In the matrix (A, actual, previous, delta and so on) I want to have tooltips if A is selected in the Parameter_Slicer that by hovering over A name in the result list, A_Number will appear in tooltip and by hoving over B name, B_number will appear and so on.

 

By using this DAX:

 

tooltip =

 Var CurrentSlicerValue = selectedvalue('ParameterSlicer'[ParameterSlicer])

Return

SWITCH(

  True()

CurrentSlicerValue = "A", "&Table[A_number]&",

CurrentSlicerValue = "B", "&Table[B_number]&",

CurrentSlicerValue = "C", "&Table[C_number]&")

 

I get an error: MdxScript(Model) (127,27) Calculation error in measure: Column [Parameter Slicer] is part of composite key, but not all columns of the composite key are included in the expression or its dependent expression.

 

Any ideas how to solve?

 

Thanks!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @newlearn123 ,
Thank you @tamerj1   very much for the solution, and I've tried other ways to help you understand the problem:

Based on your error message, it appears that the table is using composite keys.

When I used your code, I made sure that there were only Parameters in the 'ParameterSlicer' column and that my ParameterSlicer table had no complex relationship with the Employee table, and your code is working perfectly.

 

Selected_Number = Var CurrentSlicerValue = selectedvalue('ParameterSlicer'[Parameter])

Return

SWITCH(

  True(),

CurrentSlicerValue = "A", "A Number: " & MAX('EmployeeData'[A_Number]),
   CurrentSlicerValue = "B", "B Number: " & MAX('EmployeeData'[B_Number]),
   CurrentSlicerValue = "C", "C Number: " & MAX('EmployeeData'[C_Number]),
   BLANK()
)

 

vxingshenmsft_0-1721626965192.png

vxingshenmsft_1-1721626994197.png

If after trying the above you still don't solve the problem, you can also use the Allexcept function to filter out the other columns, here is the documentation on Allexcept.it would be helpful if you could provide me with your data to find a solution. Thanks.

ALLEXCEPT function (DAX) - DAX | Microsoft Learn

 

Hope it helps!

 

Best regards,
Community Support Team_ Tom Shen

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

 

 

View solution in original post

3 REPLIES 3
newlearn123
New Member

Hi together,

 

thanks very much.

Anonymous
Not applicable

Hi @newlearn123 ,
Thank you @tamerj1   very much for the solution, and I've tried other ways to help you understand the problem:

Based on your error message, it appears that the table is using composite keys.

When I used your code, I made sure that there were only Parameters in the 'ParameterSlicer' column and that my ParameterSlicer table had no complex relationship with the Employee table, and your code is working perfectly.

 

Selected_Number = Var CurrentSlicerValue = selectedvalue('ParameterSlicer'[Parameter])

Return

SWITCH(

  True(),

CurrentSlicerValue = "A", "A Number: " & MAX('EmployeeData'[A_Number]),
   CurrentSlicerValue = "B", "B Number: " & MAX('EmployeeData'[B_Number]),
   CurrentSlicerValue = "C", "C Number: " & MAX('EmployeeData'[C_Number]),
   BLANK()
)

 

vxingshenmsft_0-1721626965192.png

vxingshenmsft_1-1721626994197.png

If after trying the above you still don't solve the problem, you can also use the Allexcept function to filter out the other columns, here is the documentation on Allexcept.it would be helpful if you could provide me with your data to find a solution. Thanks.

ALLEXCEPT function (DAX) - DAX | Microsoft Learn

 

Hope it helps!

 

Best regards,
Community Support Team_ Tom Shen

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

 

 

tamerj1
Super User
Super User

Hi @newlearn123 
Use MAX or MIN instead of SELECTEDVALUE

Helpful resources

Announcements
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 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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