cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

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
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors