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
powerbiwork
Helper I
Helper I

Custom Column Query

Hi, 

I am having issues for the following. Basically Im trying to pull a live currency rate but the currency is only pulled to todays date. In close I have future dates. I want to have a custom column that if the close date is future date then just use todays date. 

powerbiwork_0-1612214517803.png

 

Thanks so much in advance

 

1 ACCEPTED SOLUTION
v-stephen-msft
Community Support
Community Support

Hi @powerbiwork ,

 

You can try to create your custom column as

if [Date]<=Date.From( DateTime.LocalNow())
then [Date] else Date.From( DateTime.LocalNow())

Screenshot 2021-02-04 143839.png

 

 

Creating a calculated column is easier.

Column = IF([Date]<=TODAY(),[Date],TODAY())

Screenshot 2021-02-04 142834.png 

 

You can check more details from here.

 

 

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

7 REPLIES 7
v-stephen-msft
Community Support
Community Support

Hi @powerbiwork ,

Could you tell me if your problem has been solved?
If it is, kindly Accept it as the solution. More people will benefit from it.
Or you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.


Best Regards,
Stephen Tao

v-stephen-msft
Community Support
Community Support

Hi @powerbiwork ,

 

You can try to create your custom column as

if [Date]<=Date.From( DateTime.LocalNow())
then [Date] else Date.From( DateTime.LocalNow())

Screenshot 2021-02-04 143839.png

 

 

Creating a calculated column is easier.

Column = IF([Date]<=TODAY(),[Date],TODAY())

Screenshot 2021-02-04 142834.png 

 

You can check more details from here.

 

 

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.

 

 

lkalawski
Memorable Member
Memorable Member

Hi @powerbiwork ,

I noticed that you forget to add brackets before "else". Please try to add it. 

 

PBI_SuperUser_Rank@1x.png Proud to be a Super User.
If I helped, please accept the solution and give kudos
Linkedin

 

 

Ah, got it thank you. But now I seem to have another error 😞 

powerbiwork_0-1612215311896.png

powerbiwork_1-1612215335967.png

 

@powerbiwork 

Before you add custom column, please check the format of CloseDate - should be "Date".

 

PBI_SuperUser_Rank@1x.png Proud to be a Super User.
If I helped, please accept the solution and give kudos
Linkedin

 

I've checked that it is date

@powerbiwork 

Please share sample of data then I can help you.

 

PBI_SuperUser_Rank@1x.png Proud to be a Super User.
If I helped, please accept the solution and give kudos
Linkedin

 

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.