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

SELECTEDVALUE() function not recognized

I'm trying to create a measure that grabs last year's sales so that I can compare them to this year's sales.

 

It is saying that the SELECTEDVALUE() is not recognized.

"The report measure FactSalesOrderDetail[Previous Yr Sales] has a syntax or semantic error at line 4, position 36, reported by Analysis Services: 'Failed to resolve name 'SELECTEDVALUE'.  It is not a valid table or function name.

 

Previous Yr Sales = CALCULATE(
	SUM(FactSalesOrderDetail[InvoiceQuantity]),
	FILTER(ALL(ActualDeliveryDate),
		ActualDeliveryDate[FiscalYear] = SELECTEDVALUE(ActualDeliveryDate[FiscalYear]) - 1 
		)
		)

Has anyone encountered this before?

1 ACCEPTED SOLUTION

@Buzz1126 instead of selectedvalue , replace it with min or max function.



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.

View solution in original post

7 REPLIES 7
parry2k
Super User
Super User

@Buzz1126 what is your data source? How you are connected?



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.

Get Data -> Analysis Services -> type in database

Hi @Buzz1126 ,

Will you have this issue if you use import mode?

If not, you may could try other aggregated function like MAX or MIN to get the value instead of SELECTEDVALUE().

If you still have the issue when you use import mode, please share some data sample and your formula so that we could have a test on it.

Best Regards,

Cherry

 

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I'm not able to use import mode as I'm connected to a live data query.  I'd think this should be something that is easily accomplished on our "data cube", but IT doesn't seem to know how to do it.  

 

I'll have to look into min/max functions, i'm not familiar with them.  

 

Thank you all for your responses.

@Buzz1126 instead of selectedvalue , replace it with min or max function.



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.

Oh! that's simple and it works! thank you

@Buzz1126 seems like you are using direct query to connect to Analysis service, read this post to understand what DAX functions are allow/optimized when direct query mode is used.

 

 



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
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.