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!

SELECTEDVALUE not works when create measure table

I'm trying to show the data for the selected week and previous week in the same table with below query.

 

 

WebAuthSSOWeeklySnapshot = 
VAR selectedDate =  DATE(2022,9,29)
// VAR selectedDate = SELECTEDVALUE('Filter-date'[Date])
VAR previousDate =  CALCULATE(MAX('Filter-date'[Date]), FILTER('Filter-date', 'Filter-date'[Date] < selectedDate))

RETURN UNION(
    SELECTCOLUMNS(FILTER('Web SSO WebAuth Health Report', 'Web SSO WebAuth Health Report'[Date] == selectedDate),
    "Channel", 'Web SSO WebAuth Health Report'[Channel],
    "This Week", 'Web SSO WebAuth Health Report'[Value],
    "Previous Week", 0,
    "Metrics Name", 'Web SSO WebAuth Health Report'[Metrics Name],
    "Platform", 'Web SSO WebAuth Health Report'[Platform]),
    SELECTCOLUMNS(FILTER('Web SSO WebAuth Health Report', 'Web SSO WebAuth Health Report'[Date] == previousDate),
    "Channel", 'Web SSO WebAuth Health Report'[Channel],
    "This Week", 0,
    "Previous Week", 'Web SSO WebAuth Health Report'[Value],
    "Metrics Name", 'Web SSO WebAuth Health Report'[Metrics Name],
    "Platform", 'Web SSO WebAuth Health Report'[Platform])
)

 

 

The query works fine if I hard code a date with 

VAR selectedDate = DATE(2022,9,29)
but not works when I use

VAR selectedDate =  SELECTEDVALUE('Filter-date'[Date])
Status: Investigating

Hi @LinpingZhang ,

 

If you run this string of statements alone, that is "VAR selectedDate =  SELECTEDVALUE('Filter-date'[Date])",is it returning the correct value? Or does it still not work.

 

Best regards,

Community Support Team Selina zhu

Comments
v-mengzhu-msft
Community Support
Status changed to: Investigating

Hi @LinpingZhang ,

 

If you run this string of statements alone, that is "VAR selectedDate =  SELECTEDVALUE('Filter-date'[Date])",is it returning the correct value? Or does it still not work.

 

Best regards,

Community Support Team Selina zhu

LinpingZhang
Employee

 

Hi @v-mengzhu-msft 

When I create a measure with below query

 

Measure =
VAR s_date = SELECTEDVALUE('Filter-date'[Date])
RETURN s_date
 
It shows correct value on card.
LinpingZhang_0-1665223414648.png