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
Anonymous
Not applicable

Can someone explain to me what is the custom column formula calculating?

Javierphang_0-1641914836391.png

i do not have a datetime. date or datetime.localnow, Date.IsCurrentMonth, Date.IsInNextMonths Columns. 

Any advice is helpful.  Thanks!

 

1 ACCEPTED SOLUTION

datetime.date or datetime.localnow, Date.IsCurrentMonth, Date.IsInNextMonths are all power query functions

for example datetime.localnow() will return the current date, and  Date.IsCurrentMonth returns true if the date provided as a parameter ([date end] in your case) is in the current month.

~you can read more about each function here Date functions - PowerQuery M | Microsoft Docs

 

basically, the code will return a 5 in [date end] is in the past,

4 if it is in the current month,

3 if next month

2 the month after that

and 1 if further n the future.

 

This is probably used to group and sort data in the report.

 

 

 

View solution in original post

4 REPLIES 4
bcdobbs
Super User
Super User

Hi they are all built in functions:
DateTime functions - PowerQuery M | Microsoft Docs
Date.IsInNextMonth - PowerQuery M | Microsoft Docs

Date.IsInNextNMonths - PowerQuery M | Microsoft Docs

 

The code is a bit odd though. In plain language it is doing:

 

If [Date End] is in the past return 5

else if [Date End] is in current month return 4

else if [Date End] + 1 month occurs in next 3 months return 3

else if [Date End] + 1 month occurs in next 6 months return 2

else return 1



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

datetime.date or datetime.localnow, Date.IsCurrentMonth, Date.IsInNextMonths are all power query functions

for example datetime.localnow() will return the current date, and  Date.IsCurrentMonth returns true if the date provided as a parameter ([date end] in your case) is in the current month.

~you can read more about each function here Date functions - PowerQuery M | Microsoft Docs

 

basically, the code will return a 5 in [date end] is in the past,

4 if it is in the current month,

3 if next month

2 the month after that

and 1 if further n the future.

 

This is probably used to group and sort data in the report.

 

 

 

amitchandak
Super User
Super User

@Anonymous , at a high level this seems fine.


Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Anonymous
Not applicable

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.