Forum Discussion
Selectedvalue date between two dates
- Anonymous1 year ago
Hi ArchieEric
Please try the following Measure:Measure = IF(SELECTEDVALUE(CalendarTable[Date]) >= SELECTEDVALUE('Table'[Start]) && SELECTEDVALUE(CalendarTable[Date]) <= SELECTEDVALUE('Table'[End]) , 1 , 0)Count rows:
Count = CALCULATE(COUNTROWS('Table'),FILTER('Table',[Measure]=1))By using measure, you can dynamically calculate the total number of rows based on the different dates you choose.
Result:Best Regards,
Jayleny
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi ArchieEric It looks like your DAX code isn’t returning the expected results because the SELECTEDVALUE function might not be working as intended without a relationship between the tables. You can try this code:
SelectedMasters =
VAR selectedmonth = SELECTEDVALUE('Months'[Month Year])
RETURN
IF (
NOT ISBLANK(selectedmonth) &&
'ContinuousService'[ContractStart] <= selectedmonth &&
'ContinuousService'[ContractEnd] >= selectedmonth,
1,
0
)
It will return 0 if selectedmonth is blank. I would suggest try develop relationship using virtual relationship function TREATAS if possible.
Hope this helps!!
If this solved your problem, please accept it as a solution and a kudos!!
Best Regards,
Shahariar Hafiz