Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
vjnvinod
Impactful Individual
Impactful Individual

Week Ending Date in Power query editor using custom coloumn

Hi All,

 

Currently i am using the below formula  in excel to get my week ending date 

=[@[Transaction Date]]+7-WEEKDAY([@[Transaction Date]],16)

 

How do i get this logic in power query editior using custom coloumn?

i am aware i can create a "calculated coloumn" but for some reason i want to do this calculation in power query editor?

 

Let me know if you can help on this

1 ACCEPTED SOLUTION
mahoneypat
Employee
Employee

In the code for the step you added for end of week, just add Day.Saturday like this

 

= Table.AddColumn(#"Inserted Quarter", "End of Week", each Date.EndOfWeek([Date], Day.Friday), type date)

 

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

3 REPLIES 3
mahoneypat
Employee
Employee

In the code for the step you added for end of week, just add Day.Saturday like this

 

= Table.AddColumn(#"Inserted Quarter", "End of Week", each Date.EndOfWeek([Date], Day.Friday), type date)

 

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


CNENFRNL
Community Champion
Community Champion

Hi, @vjnvinod , it's even easier in Power Query; a prêt-à-manger functionality is available on UI.

Untitled.pngUntitled.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

vjnvinod
Impactful Individual
Impactful Individual

@CNENFRNL 

 

This is good, but looks like its taking saturday as week ending in my data

is there anyway we can change this to Friday as week ending 

 

basically below logic(which is in excel)

=[@[Transaction Date]]+7-WEEKDAY([@[Transaction Date]],16)

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.