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.
We produce reporting on a bi-weekly basis based on a reporting calendar. I am trying to generate a calculated column to represent the Period Ending Date. Our weeks end on a Sunday and our data is seperated to daily when it's brought into Power BI.
Using a "seed" date of 08/02/2020 (which aligns with our calendar), I have successfully created this Period Ending Date field using the following in SQL:
dateadd(day, ceiling(datediff(day,'8/2/2020', daily_date) / 14.0) * 14, '8/2/2020') As period_end_date,
However, when I try a simliar function to create a New Column in Power BI, the results are either blank or just wrong:
Period Ending Date = DATEADD('pcwb budget daily'[08022020], (CEILING(DATEDIFF(DATE(2020,8,2),'pcwb budget daily'[daily_date],DAY) / 14,1) * 14),DAY)
NOTE: Since the Dax DATEADD will not allow a constant as the first parameter, I created a column to hold the "seed" date. That column is named 'pcwb budget daily'[08022020]. For all rows, it's value is 8/2/2020.
I don't know if I'm dealing with a data type issue or if I'm just misunderstanding the Dax functions (e.g. expecting them to work like SQL's).
Solved! Go to Solution.
Your response at least got me in the right direction. Here is the solution:
Period Ending Date = 'pcwb budget daily'[daily_date] + mod(datediff('pcwb budget daily'[daily_date],DATE(2020,8,2),DAY), 14)
@tunneling , Try a new column like
'pcwb budget daily'[daily_date] + mod(datediff(DATE(2020,8,2), 'pcwb budget daily'[daily_date],DAY),14) *14
or
'pcwb budget daily'[daily_date] + (mod(datediff(DATE(2020,8,2), 'pcwb budget daily'[daily_date],DAY),14)+1) *14
Your response at least got me in the right direction. Here is the solution:
Period Ending Date = 'pcwb budget daily'[daily_date] + mod(datediff('pcwb budget daily'[daily_date],DATE(2020,8,2),DAY), 14)
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 |
---|---|
64 | |
63 | |
52 | |
39 | |
24 |
User | Count |
---|---|
80 | |
57 | |
45 | |
44 | |
35 |