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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
laciodrom_80
Helper IV
Helper IV

Problem using SELECTEDVALUE in Direct Query mode

Hi guys,

 

I' ve imported in power bi desktop by Direct Query a table (MyTable) and I've created a measure (MyMeasure) to get the column value Column2 when I select a table row:

 

MyMeasure = IF(ISFILTERED(MyTable[Column2]);SELECTEDVALUE(MyTable[Column2]);"No selection")

This measure works fine using Import Mode, while no value is returned by SELECTEDVALUE function in Direct Query modeSmiley Frustrated

 

Any suggestions? How can I fix this in Direct Query?

 

Thanks in advance for any hint

Luca
9 REPLIES 9
rodrigoromaygq
New Member

Hello @laciodrom_80 

Were you able to solve this issue?

I need to get the selected value from a table whose data source = Direct Query. 

As you mention, SELECTEDVALUE, MIN or MAX don't work.

parry2k
Super User
Super User

@laciodrom_80 you can use other aggregated function like MAX or MIN to get the value instead of SELECTEDVALUE



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.

@parry2k I've tried but no value returned also both with MAX and MIN

 

MyMeasure = IF(ISFILTERED(MyTable[Column2]);MAX(MyTable[Column2]);"No selection")
Luca

@laciodrom_80 not sure why that would be the case. why not just drop a Card Visual and column2 on it (use max) from aggreation and see what result you get. We expect the measure to give the same result .



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.

@parry2k Card Visual returns Empty value when I select a table row, No selection when I don't select any row

 

No selection:

NoSelection.png

 

First row selected:

Selected.png

 

Vuoto is the italian for empty Smiley Wink

Luca

@laciodrom_80 so i guess measure is doing the same thing, not fully sure what is going on. very hard to explain. I expected it to return 02149 when you selected first row. 



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.

@laciodrom_80 hope this helps https://docs.microsoft.com/en-us/sql/analysis-services/tabular-models/dax-formula-compatibility-in-d...



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.

@parry2k  I noticed I have the problem with a sql server on-premises (not installed on my pc), if I try using a sql server on cloud no issue, also using SELECTEDVALUE.

What could be the problem? With Power BI Desktop I don't have to use any gateway, do I ? 

Luca

@parry2k I'm on the horns of a dilemma😠, what kind of limitations are there using measures in direct query mode?
Luca

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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