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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
inawab
Frequent Visitor

If today is Sunday

Hi every one,

 

I have a report showing 3 days operation, yesterday, Today, and tomorrow, but the on Sunday the bigging of the week I need this report to show Thursday, Friday, and Saturday, and this is only on sunday

 

Can someone advise how to do this??

this what I have done so far:

 

if [Oper.Date UTC] = DateTime.Date(DateTime.LocalNow()) then "Today"
else if [Oper.Date UTC] = DateTime.Date(Date.AddDays(DateTime.LocalNow(),-1)) then "Yesterday"
else if [Oper.Date UTC] = DateTime.Date(Date.AddDays(DateTime.LocalNow(),+1)) then "Tomorrow"
else if [Oper.Date UTC] = DateTime.Date(Date.AddDays(DateTime.LocalNow(),-2)) and [Oper.Date UTC] = Day.Sunday then "Friday"
else if [Oper.Date UTC] = DateTime.Date(Date.AddDays(DateTime.LocalNow(),-3)) and [Oper.Date UTC] = Day.Sunday then "Thursday"
else null

1 ACCEPTED SOLUTION
Vijay_A_Verma
Super User
Super User

Use this

 

 

= if Date.DayOfWeekName(DateTime.Date(DateTime.FixedLocalNow()))="Sunday" and Date.From([Oper.Date UTC]) = DateTime.Date(Date.AddDays(DateTime.LocalNow(),-1)) then "Saturday" else 
if Date.DayOfWeekName(DateTime.Date(DateTime.FixedLocalNow()))="Sunday" and Date.From([Oper.Date UTC]) = DateTime.Date(Date.AddDays(DateTime.LocalNow(),-2)) then "Friday" else
if Date.DayOfWeekName(DateTime.Date(DateTime.FixedLocalNow()))="Sunday" and Date.From([Oper.Date UTC]) = DateTime.Date(Date.AddDays(DateTime.LocalNow(),-3)) then "Thursday" else  
if Date.DayOfWeekName(DateTime.Date(DateTime.FixedLocalNow()))<>"Sunday" and Date.From([Oper.Date UTC]) = DateTime.Date(DateTime.LocalNow()) then "Today" else
if Date.DayOfWeekName(DateTime.Date(DateTime.FixedLocalNow()))<>"Sunday" and Date.From([Oper.Date UTC]) = DateTime.Date(Date.AddDays(DateTime.LocalNow(),-1)) then "Yesterday" else
if Date.DayOfWeekName(DateTime.Date(DateTime.FixedLocalNow()))<>"Sunday" and Date.From([Oper.Date UTC]) = DateTime.Date(Date.AddDays(DateTime.LocalNow(),+1)) then "Tomorrow" else
null

 

 

View solution in original post

2 REPLIES 2
Vijay_A_Verma
Super User
Super User

Use this

 

 

= if Date.DayOfWeekName(DateTime.Date(DateTime.FixedLocalNow()))="Sunday" and Date.From([Oper.Date UTC]) = DateTime.Date(Date.AddDays(DateTime.LocalNow(),-1)) then "Saturday" else 
if Date.DayOfWeekName(DateTime.Date(DateTime.FixedLocalNow()))="Sunday" and Date.From([Oper.Date UTC]) = DateTime.Date(Date.AddDays(DateTime.LocalNow(),-2)) then "Friday" else
if Date.DayOfWeekName(DateTime.Date(DateTime.FixedLocalNow()))="Sunday" and Date.From([Oper.Date UTC]) = DateTime.Date(Date.AddDays(DateTime.LocalNow(),-3)) then "Thursday" else  
if Date.DayOfWeekName(DateTime.Date(DateTime.FixedLocalNow()))<>"Sunday" and Date.From([Oper.Date UTC]) = DateTime.Date(DateTime.LocalNow()) then "Today" else
if Date.DayOfWeekName(DateTime.Date(DateTime.FixedLocalNow()))<>"Sunday" and Date.From([Oper.Date UTC]) = DateTime.Date(Date.AddDays(DateTime.LocalNow(),-1)) then "Yesterday" else
if Date.DayOfWeekName(DateTime.Date(DateTime.FixedLocalNow()))<>"Sunday" and Date.From([Oper.Date UTC]) = DateTime.Date(Date.AddDays(DateTime.LocalNow(),+1)) then "Tomorrow" else
null

 

 

Thanks for your help

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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