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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Pfoerster
Helper III
Helper III

Problem with SELECTEDVALUE

Hello, 

I need again some help:

I want to build up a report, where the user can select out of the Mastertable sales of a selected period and compare it to another selected period. 

Here is my solution: 
I build up two additional "month tables": "Month hist" and "Month fut".

Now, the user should select in the "Month hist" slicer some month (apr, may, jun) as one base, and in the "Month fut" another period (i.e. oct, nov, dec) and will get two values: "hist sales" and "fut sales". 

I tried to build it up as SELECTEDVALUE formula, and it is working when I select one month in each selection. But if i select two month in a single slicer, the Sum(SELECTEDVALUE) is not showing anything. 

 

How can I solve this problem? Thank you for any help.

1 ACCEPTED SOLUTION
v-rzhou-msft
Community Support
Community Support

Hi @Pfoerster 

Selectvalue function can only be used to single select value.

Please try value function to get mulitiple values and use in instead of "=" in your measure.

My sample:

1.png

Month hist table and Month Fut table are the same.

2.png

Measure:

 

fut filter = 
VAR _SelectMonthhist = VALUES('Month fut'[Month fut])
Return
IF(ISFILTERED('Month fut'[Month fut]),IF(MAX('Table'[Month]) in _SelectMonthhist,1,0),0)
hist filter = 
VAR _SelectMonthhist = VALUES('Month hist'[Month hist])
Return
IF(ISFILTERED('Month hist'[Month hist]),IF(MAX('Table'[Month]) in _SelectMonthhist,1,0),0)

 

I build two table visuals to show the result. Add hit filter in filter field in one visual and set it to show items when value =1. Add fut filter in filter field in other visual and do the same option.

Result:

By default two visuals will show blank.

3.png

Select Jan,Feb,Mar in Month hist and select Aug,Sep,Oct in Month fut.

4.png

Best Regards,

Rico Zhou

 

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

2 REPLIES 2
v-rzhou-msft
Community Support
Community Support

Hi @Pfoerster 

Selectvalue function can only be used to single select value.

Please try value function to get mulitiple values and use in instead of "=" in your measure.

My sample:

1.png

Month hist table and Month Fut table are the same.

2.png

Measure:

 

fut filter = 
VAR _SelectMonthhist = VALUES('Month fut'[Month fut])
Return
IF(ISFILTERED('Month fut'[Month fut]),IF(MAX('Table'[Month]) in _SelectMonthhist,1,0),0)
hist filter = 
VAR _SelectMonthhist = VALUES('Month hist'[Month hist])
Return
IF(ISFILTERED('Month hist'[Month hist]),IF(MAX('Table'[Month]) in _SelectMonthhist,1,0),0)

 

I build two table visuals to show the result. Add hit filter in filter field in one visual and set it to show items when value =1. Add fut filter in filter field in other visual and do the same option.

Result:

By default two visuals will show blank.

3.png

Select Jan,Feb,Mar in Month hist and select Aug,Sep,Oct in Month fut.

4.png

Best Regards,

Rico Zhou

 

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

parry2k
Super User
Super User

@Pfoerster not sure what you mean by sum selectedvalue, if more than one value is selected, it will return blank, you can use values function to get the list of months selected.

 

COUNTROWS ( VALUES ( Table[Month] ) )

 

Check my latest blog post Year-2020, Pandemic, Power BI and Beyond to get a summary of my favourite Power BI feature releases in 2020

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.