Date & time

MonthStart, AddMonths, YearToDate, Week, InYear, Today, Age, MakeDate, Date# parsing, NetWorkDays and building a calendar table.

MonthStart(date [, period_no]) MonthStart, MonthEnd and period boundaries MonthStart and MonthEnd return the first or last millisecond of a month. Use Date.StartOfMonth and Date.EndOfMonth in Power Query, or EOMONTH in DAX. Note that STARTOFMONTH in DAX is a table function, not the same thing. Direct equivalent AddMonths(startdate, n [, mode]) AddMonths AddMonths shifts a date by n months. EDATE (DAX) and Date.AddMonths (M) do the same with mode 0 semantics. Mode 1 (end-relative) needs a few extra lines. DAX DATEADD is not the same function. Direct equivalent YearToDate(date [, yearoffset [, firstmonth [, todaydate]]]) YearToDate flags and YTD Qlik's YearToDate() flag is relative to the reload date. DAX TOTALYTD is relative to the dates in the filter context. Pick the one that matches what users expect, or rebuild the flag as a calculated column. Partial / different approach Date(Date#(text, 'YYYYMMDD'), 'DD-MM-YYYY') Date#() parsing and Date() formatting Date#() interprets text as a date and Date() formats a number as a date, keeping it a dual. In Power BI, parse in Power Query with Date.FromText and set the display format on the column. DAX FORMAT() turns a date into text. Partial / different approach NetWorkDays(start, end [, holiday...]) NetWorkDays (working days) NetWorkDays counts Monday-to-Friday working days between two dates, minus listed holidays. DAX has NETWORKDAYS with configurable weekends and a holiday table. A working-day flag on the date table is often the more maintainable option. Direct equivalent LOAD ... AUTOGENERATE ... WHILE ... IterNo() Master calendar (date table) The Qlik master calendar script maps to a date table built in Power Query (List.Dates) or DAX (CALENDAR), marked as a date table and related to the fact date. It is essential for every time-intelligence function. Direct equivalent Week(OrderDate) Week, WeekYear and WeekDay Qlik's Week() follows the FirstWeekDay, BrokenWeeks and ReferenceDay settings. The defaults give ISO-style weeks, where week 1 contains 4 January. DAX matches that with WEEKNUM(date, 21). Power Query's Date.WeekOfYear is not ISO, so compute ISO weeks yourself or in DAX. WeekDay returns a dual (0–6 plus the day name). In Power BI, that's a number column plus a name column sorted by it. Partial / different approach Sum(If(InYear(OrderDate, Today(), -1), Sales)) InYear, InMonth and period flags Qlik developers often put InYear() and InMonth() flags in the script (-1 or 0) and multiply by them in charts, or use them inside If(). In Power BI, the equivalent is a calendar table with offset columns (YearOffset, MonthOffset), filtered with CALCULATE or a relative-date slicer. Time-intelligence functions such as SAMEPERIODLASTYEAR cover the common cases. Partial / different approach Today() Today and Now Qlik's Today() and Now() take a timer mode: 0 for the last finished reload, 1 for the function call, 2 for when the app was opened. In Qlik Cloud they evaluate in UTC. DAX TODAY() and NOW() in a measure run at query time. In a calculated column they run at refresh time. In the Power BI service both are UTC, so convert to local time yourself. Partial / different approach Interval(EndTime - StartTime, 'hh:mm') Age, Interval and date differences In Qlik, dates are numbers, so End - Start is a number of days and Interval() just formats it. DAX DATEDIFF counts boundaries crossed, not completed units. DATEDIFF(dob, today, YEAR) isn't an age, so use a completed-years formula for Age(). DAX has no duration type. Store durations as numbers, such as minutes or hours, and format them for display. Partial / different approach MakeDate(Year, Month, 1) MakeDate and MakeTime MakeDate(YYYY, MM, DD) maps directly to DAX DATE(y, m, d) and Power Query #date(y, m, d). MakeTime maps to TIME() and #time(). Watch out for invalid input. DAX DATE rolls over, so month 13 becomes January of the next year, while Power Query #date raises an error. Direct equivalent Floor(OrderTimestamp) AS OrderDate Splitting timestamps into date and time Qlik developers split timestamps with Floor() for the date and Frac() for the time, partly to save memory. Do the same in Power Query with DateTime.Date and DateTime.Time. It makes the date join to the calendar table and reduces column cardinality in VertiPaq, so the reason is the same in both tools. Direct equivalent