Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
Could somebody please help me convert my SQL query to DAX?
DateDiff(month, dateadd(month, -1, DateUpdated), Isnull(Date1, IsNull(Date2, DateUpdated)))
Thanks in advance
Liam
Solved! Go to Solution.
Hi @Anonymous
try
Column =
var _endDate = IF(ISBLANK([Date1]), IF(ISBLANK([Date2]), [DateUpdated],[Date2]) ,[Date1])
RETURN
DATEDIFF(DATEADD([DateUpdated], -1, MONTH), _endDate, MONTH)
Hi @Anonymous
try
Column =
var _endDate = IF(ISBLANK([Date1]), IF(ISBLANK([Date2]), [DateUpdated],[Date2]) ,[Date1])
RETURN
DATEDIFF(DATEADD([DateUpdated], -1, MONTH), _endDate, MONTH)
Hi @az38,
Thanks for your reply. Date 1 and Date 2 are both fields from calculation columns and its only suggesting measure values on intellisense?
Also, could you please advise on how the measure would be If I was to sum total rows and get a count of rows that had this specified datediff below?
Thanks in advance
Liam
@Anonymous
if your Date1 and Date2 are calculated columns my advice is to create a calculated column, not easure for datediff
For second task try a technique like
measure =
calculate(COUNTROWS(Table), ALLEXCEPT(Table, Table[DatediffColumn]))
Hi @az38 ,
Thanks so much for your reply.
I have this currently, and I've decided on putting a 1 in the cell if its applicable.
They are all displaying as 1 with this formula. Can you spot anything incorrect?
@Anonymous
i will not be able to help you without data example
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
23 | |
10 | |
10 | |
9 | |
7 |