Forum Discussion
JulietZhu
7 years agoHelper IV
DAX help
I need convert the following sql to DAX. Basically I need count distinct taskID, which is created before 20180101 with In progress and not started status. select count(distinct (taskID)), count(*...
- 7 years ago
this is what you need
taskBegDay3 = VAR _selected = SELECTEDVALUE('Date'[Date (bins)],0) return CALCULATE ( DISTINCTCOUNT(Task[TaskID]) ,filter(TaskStatus,TaskStatus[TaskStatus] in {"In Progress","Not Started"}) ,FILTER(ALL(Task), _selected > Task[createddate]) )
JulietZhu
7 years agoHelper IV
Nickgastaldi, it works. Thanks so much. Try to understand selectedvalue you are using.
Nickgastaldi
7 years agoResolver I
SELECTEDVALUE(column)
return the value of the selected row if it was used in a slicer or selected by user
if you have a table for instance, and wants to do a calculation based on a row selected by the user, SELECTEDVALUE(YourColumn) will return the value on that row.
its very straight forward :)
- JulietZhu7 years agoHelper IV
Nickgastaldi, Thanks for explanation