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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
leolapa_br
Resolver I
Resolver I

SELECTEDVALUE measure from slicer keeps returning blank value when used on another measure

So I have this simple dropdown slicer which is a list containing only a couple of dates, which in turn comes from a single-column table currently with NO relationship to either the date and the fact tables (CalData and Contas_a_Pagar respectively) in the semantic model:

Slicer.png

Then I created the following measure that picks up whatever choice I made on the aforementioned slicer:

Data-base = SELECTEDVALUE(Data_Base_Lista[Data-base])

And when I drop this measure on a card visual it works just fine, so the measure is in fact picking up my date slicer choice:

Measure on Card Visual.png

PROBLEM: However, when I define and evaluate the same measure on DAX query view, it returns BLANK:

Define and Evaluate Measure.png

↓↓↓↓↓↓↓

Measure Data-Base Result on DAX Query View.png

The problem is that I'm using this measure as a base date to calculate other measures, for instance to calculate the total of invoices whose due dates are on or after the selected base-date, and this measure is instead returning the grand total of all invoices (it should be $1,535,135.96 not $5,475,597.89 as shown below), and the reason is because the measure 'Date-base' is BLANK, so this other measure ends up picking up all invoices since their due dates are all on or after a blank date:

Measure Total a Vencer Result on DAX Query View.png

Conversely, when I setup another measure that is supposed to calculate the total of invoices whose due dates are before the selected date, this measure also returns BLANK, instead of the correct total amount of $3,940,461.93, since this measure can't find any due date that is prior to a blank base-date:

Measure Total Vencidos Result on DAX Query View.png

QUESTION: I know this is a basic stupid issue, but I just can't seem to figure out a way to fix this, even after having watched several videos about the SELECTEDVALUE function. What am I doing wrong here?

Thanks,

Leonardo

1 ACCEPTED SOLUTION
FBergamaschi
Solution Sage
Solution Sage

Hello,

in DAX query view, you do not have the filter you apply in the visualization, so SELECTEDVALUE returns a blank.

 

If you want to see the value in the query view, you need to inject the filter like instalead of calling the measure [Data-base] in row 6 or 8 (depending on the images you show) you call

 

CALCULATE ( [Data-base], Data_Base_Lista[Data-base] = DATE ( 2025,7,17 ) )

 

YOu can also let Power BI do this automatically if you open the performance analyzer, start recording and refresh that visual. You can then copy the query and paste it in the query view.  You will see there that Power BI injects the selected value form the visual into the query, typically with a TREATAS table call, then used as a FILTER (DSO_FILTER or something like this)

 

If this helped, please consider giving kudos and mark as a solution

@me in replies or I'll lose your thread

Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page

Consider voting this Power BI idea

Francesco Bergamaschi

MBA, M.Eng, M.Econ, Professor of BI

 

 

View solution in original post

3 REPLIES 3
lbendlin
Super User
Super User

DAX Query view is not aware of your filter context, you have to tell it all the filters you want to use, ideally via TREATAS.

FBergamaschi
Solution Sage
Solution Sage

Hello,

in DAX query view, you do not have the filter you apply in the visualization, so SELECTEDVALUE returns a blank.

 

If you want to see the value in the query view, you need to inject the filter like instalead of calling the measure [Data-base] in row 6 or 8 (depending on the images you show) you call

 

CALCULATE ( [Data-base], Data_Base_Lista[Data-base] = DATE ( 2025,7,17 ) )

 

YOu can also let Power BI do this automatically if you open the performance analyzer, start recording and refresh that visual. You can then copy the query and paste it in the query view.  You will see there that Power BI injects the selected value form the visual into the query, typically with a TREATAS table call, then used as a FILTER (DSO_FILTER or something like this)

 

If this helped, please consider giving kudos and mark as a solution

@me in replies or I'll lose your thread

Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page

Consider voting this Power BI idea

Francesco Bergamaschi

MBA, M.Eng, M.Econ, Professor of BI

 

 

Understood. I initially thought the DAX query editor would pick up whatever slicer choice I have on the report, but I realized that can't be done since there could be several unsynced slicers tied to the same field and placed on several different reports under the same .pbi file, which would make it impossible for the DAX query editor to choose which slicer to grab the value from.

Thanks for taking the time to clarify that!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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