Forum Discussion
Anonymous
6 years agoNot applicable
DateDiff with multiple ISBLANK
Hi,
Could somebody please help me to convert my SQL to DAX below?
Sum(case when DateDiff(month, @ReportPeriodStartDate, TDate) < 0 AND
DateDiff(month, @ReportPeriodStartDate, Isnull(WDate, IsNull(CDate, @ReportDate))) > 0 then 1 else 0 end)
I have
DIM =
VAR ReportPeriodStartDate = DATEADD(vwtest[DateUpdated],-1,MONTH)
RETURN
IF(DATEDIFF(ReportPeriodStartDate, vwtest[TDate],MONTH) < 0 &&
DATEDIFF(ReportPeriodStartDate,ISBLANK(vwtest[WDate]),ISBLANK(vwtest[DateU],MONTH) > 0,1,0)
Its not displaying correctly. Its the isnulls that I'm struggling to convert I think
Any help would be greatly appreciated.
Thanks
Liam
Anonymous, I doubt your the usage of is blank in place of isnull, From March release power bi supported coalesce , please use that
4 Replies
- Greg_DecklerCommunity Champion
Please don't just post SQL and ask "how do I do this in DAX?" Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
Sample data, expected result.
- AnonymousNot applicable
- Greg_DecklerCommunity ChampionSometimes, depending on the data, which is why it is extremely helpful to see it, you need to do something like <> "" or = "null" or something along those lines.