Up and Running on DAX for Power BI by Unknown

Up and Running on DAX for Power BI by Unknown

Author:Unknown
Language: eng
Format: epub, pdf


ChapTer 9 CalCulaTions on DaTes: using DaX Time inTelligenCe

Finding the Difference Between Two Dates

Finding the difference in days between two dates in DAX can be done in a similar way to Excel; simply subtract one date from another. However, in DAX, you must nest the dates

in the INT function to return a value in days as opposed to returning a date:

Days Difference =

INT ( [Date of Last Transaction] ) - INT ( [Date of First Transaction] )

DAX also has the same function DATEDIFF that we use in Excel to find the difference

between weeks, months, years, etc. (see Figure 9-15).

Months Difference =

DATEDIFF ( [Date of First Transaction], [Date of Last Transaction], MONTH )

Figure 9-15. Calculating days between and months between two dates

162

ChapTer 9 CalCulaTions on DaTes: using DaX Time inTelligenCe

Hopefully, our foray into some of the more ubiquitous DAX time intelligence

functions has whetted your appetite for performing calculations on dates. There are of

course a number of other time intelligence functions that we haven’t explored here but

that you might find useful in the analysis of your data, so why not self-explore more of these valuable DAX functions. You will find them all here:

https://docs.microsoft.com/en- us/dax/time- intelligence- functions- dax

163



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Categories