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
marcio_fornari
Resolver I
Resolver I

Custom Column Today and Yesterday

Hello Everyone, i need help to add custom column into my calendar whit Power Query

 

I need a column write "Today" and "Yesterday".. but there are some conditions for this.

It's very complex for me and It's very confused 😅
I will try explain:

Has 2 situations: 
Holiday Date and Sunday (workday = 0) 
Mon,Tue,Wed,Thu,Fri,Sat (workday = 1)

IF Yesterday date, (today is Tuesday, yesterday was monday)
and the yesterday workday is 1 then write "Yesterday" at Today Date.
Example:

Today is 2021-08-23..

marcio_fornari_1-1629824957523.png

 

For me the date of tomorrow 2021-08-24 it's considered Today date and Today date it's considered Yesterday.. but if have holiday or sunday or Today is Friday or Monday it's changed.

Example below for Today:
if today is Friday (2021-08-27), for me i consider Today as (saturday and Monday)

marcio_fornari_2-1629825178638.png


Example below for Yesterday:

if Today is monday  i consider Yesterday date as the Today Date and the Last Workday = 1 from today
Example.. Today is monday. For me, yesterday is Today (monday) and Saturday

marcio_fornari_3-1629825325847.png

 


With a holiday between the dates:
Write Today:
if the next day from today the workday is 0, i considered Today as Today Date + next day where workday is 1
Example.. today is 2021-08-23 and tomorrow the workday is 0..

marcio_fornari_5-1629827030350.png

 



Write Yesterday:
if Yesterday the workday was 0, i considered Yesterday as the last workday = 1 from today
Example:
if today is 2021-08-24 and yesterday (2021-08-23) was holiday(work day = 0)
Yesterday for me is Monday and Today
and Tomorrow 2021-08-25 is Today.

marcio_fornari_4-1629826695361.png

 

That's it..
Very confused..



1 REPLY 1
v-jingzhang
Community Support
Community Support

Hi @marcio_fornari 

 

Sorry I'm still very confused about the logic. Can you help answer the following questions first?

 

When you say "today is ...", does this "today" refer to the local date (system date) when you refresh the query?

 

In general, my understanding is that if "today" is a working day, its previous working day should always have "Yesterday" and its next working day should always have "Today". But in some of above examples Today has "Yesterday" (images 1, 3,5), and in image 4 it has "Today" while in image 2 it has null?

 

Additionally, all of your examples have an assumption that today is a working day. What if today is not a working day?

 

And in all examples, all holidays have only a single day. Will some holidays have several continuous days in the calendar? If so, what should be the result?

 

Can you help us understand the logic more clearly?

 

Regards,
Community Support Team _ Jing

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.

Top Solution Authors
Top Kudoed Authors