Forum Discussion
calendar selectedvalue compare another table
hi , i have calendar table and used in below calendar slicer. how can i get the selectedvalue which is highlight in red.
and it shoud compare with another table date column which is available or not.
if user selects the future date from the below calendar which is not available in another table. message should show or empty the visual. please help me with dax function..
note: i dont want to use the dropdown slicer option. same type i need.
Hi ,
I tried the following:
- Calendar is your Calendar table
- Calendar1 is your other table which contains the dates to check existence in your selection
- Create measure to return Selected Max Date
SelectedMaxDate = VAR SelectedMaxDate = CALCULATE( MAX('Calendar'[Date]), ALLSELECTED('Calendar') ) RETURN SelectedMaxDate- Create measure to check weather Selected Max Date is part of Calendar1. If yes, return "" otherwise return "Error".
CheckDate = VAR CheckDate = CONTAINSROW(VALUES(Calendar1),[SelectedMaxDate]) VAR Result = IF( CheckDate, "", "Error" ) RETURN ResultPBiX file under the link below:
Best regards
6 Replies
- amitchandakSuper User
In a measure you can get the max date using
selectedvalue(Date[Date])
or
Maxx(allselected(Date), Date[date])
- mohammadraficHelper I
it is bring end of the year date...it is not working .. and i need to compare that date with another table date is available or not.
or can you tell me how to hide the future dates from the abve pls
- ITManuelResponsive Resident
Hi ,
I tried the following:
- Calendar is your Calendar table
- Calendar1 is your other table which contains the dates to check existence in your selection
- Create measure to return Selected Max Date
SelectedMaxDate = VAR SelectedMaxDate = CALCULATE( MAX('Calendar'[Date]), ALLSELECTED('Calendar') ) RETURN SelectedMaxDate- Create measure to check weather Selected Max Date is part of Calendar1. If yes, return "" otherwise return "Error".
CheckDate = VAR CheckDate = CONTAINSROW(VALUES(Calendar1),[SelectedMaxDate]) VAR Result = IF( CheckDate, "", "Error" ) RETURN ResultPBiX file under the link below:
Best regards