Forum Discussion
filter by actual date
- 9 years ago
1) since you're using CALCULATE, you don't need the explicit FILTER
2) If you don't convert the literal string 1/1/2016 to a date by use of DATE() (e.g. DATE(2016,1,1)) then PowerBI interprets it as "1 divided by 1 divided by 2016", giving a number value that converts to Dec 30, 1899 (I believe - somewhere around there). Try
ActiveByDate = calculate( countrows('Table A'), 'Table A'[Period] > date(2016, 1, 1) //or = or <, etc )Hope this helps.
David
1) since you're using CALCULATE, you don't need the explicit FILTER
2) If you don't convert the literal string 1/1/2016 to a date by use of DATE() (e.g. DATE(2016,1,1)) then PowerBI interprets it as "1 divided by 1 divided by 2016", giving a number value that converts to Dec 30, 1899 (I believe - somewhere around there). Try
ActiveByDate = calculate(
countrows('Table A'),
'Table A'[Period] > date(2016, 1, 1) //or = or <, etc
)
Hope this helps.
David
- CahabaData9 years ago
Memorable Member
thanks.... a literal date entry I rarely use in a DAX statement... usually refering to a Date Field....
so it wasn't clear to me as to whether one wrapped/bracketed a date field to indicate it as a date or whether these days in Power BI it would recognize the general format in context to the field it was being compared.....
since it wasn't throwing an error but just giving me an odd result - I was perplexed.... surprisingly I spent alot of time searching for a literal date entry example and couldn't seem to find one.....
- dedelman_clng9 years ago
Community Champion
Yeah, I sometimes have difficulty getting out of "SQL Server" mindset and into DAX mindset. Dates and Booleans are not as simple in DAX / PowerBI. :smileyhappy: