Forum Discussion
PatrickByGecko
6 years agoHelper V
Probleme when Evaluating dates
Hello
I get a problem when comparing to dates, Is this instruction correct?
VAR _DateBeginMonth = DATEVALUE("01/" & MONTH(TODAY()) & "/" & YEAR(TODAY()))
VAR _DateBeginFinal = if ( 'TABLE'[DATE BEGIN] <= _DateDebutMonth ; _DateDebutMonth; 'TABLE'[DATE BEGIN] )
Because this comparison is always false though I'm sure 'TABLE'[DATE BEGIN] is bigger than _DateDebutMonth.
So I suppose I have a problem of syntax...
Hi
I did put my conditions inside the FIlter command and it is OK. It is not a beautiful code but it works...
Thank you again.
8 Replies
- mwegenerMost Valuable Professional
Hi PatrickByGecko ,
try DATE instead of DATEVALUE.
https://docs.microsoft.com/en-us/dax/date-function-dax
- PatrickByGeckoHelper V
I did this way
VAR _DateBeginMonth = DATE( YEAR(TODAY()); MONTH(TODAY()) ; 1)But the comparison gives the same, is always false though I'm sure 'TABLE'[DATE BEGIN] is bigger.- PatrickByGeckoHelper V
When I display the values so as to check
VAR _DateBeginMonth = 43922 and 'TABLE'[DATE BEGIN] = 43942. So the problem must coming from the syntax of comparison. I think..