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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
ThamerTK
Regular Visitor

How to create customs columns from several fileds in Power BI similar to Excel.

Hi, I'm new to Power BI. I would like to crate several custom columns that are formed using logical conditions.  In Excel, I can do that for example as follows: =IF(OR(AK7="NA",AL7="NA"),"NA",IF(OR(TODAY()>AK7,TODAY()-AL7>5*365),0,1)), were AK7, AL7, and Today() are columns and function. I have many like that.  But I'm facing difficulties in doing this in Power BI.  

 

Can you help in providing a genral syntax to do that. for example, referring to AK7m and AL7 as column 1 and Column 2, and how to use function like Today() with its correct syntax in Power BI?

2 ACCEPTED SOLUTIONS
Ritaf1983
Super User
Super User

Hi @ThamerTK 
Today() works in the same way as in eExcel.
About others 

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Please show the expected outcome based on the sample data you provided.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523



Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

Anonymous
Not applicable

Hi @ThamerTK ,

 

Custom columns are created in Power Query by M language.

I'm sorry for my reconfirmation. Do you want to create a measure, a calculated column, or a custom in Power BI? Measure and calculated columns are created by DAX and will only appear in Power BI Desktop.

For now, if you want custom columns in Power Query, please try:

   if [Column1] = "NA" or [Column2] = "NA" then "NA"
   else if DateTime.LocalNow() > [Column1] or DateTime.LocalNow() - [Column2] > #duration(5, 0, 0, 0) then 0
   else 1

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.           

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @ThamerTK ,

 

Custom columns are created in Power Query by M language.

I'm sorry for my reconfirmation. Do you want to create a measure, a calculated column, or a custom in Power BI? Measure and calculated columns are created by DAX and will only appear in Power BI Desktop.

For now, if you want custom columns in Power Query, please try:

   if [Column1] = "NA" or [Column2] = "NA" then "NA"
   else if DateTime.LocalNow() > [Column1] or DateTime.LocalNow() - [Column2] > #duration(5, 0, 0, 0) then 0
   else 1

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.           

Ritaf1983
Super User
Super User

Hi @ThamerTK 
Today() works in the same way as in eExcel.
About others 

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Please show the expected outcome based on the sample data you provided.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523



Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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