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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Switch formula with 2 conditions

Hello. 

 

The basis of my problem is this:

 

BeginningEndCycle
Fri  11:00:00Mon 10:59:5930
Mon 11:00:00Tue 10:59:5940
Tue 11:00:00Wen 10:59:5950
Wed 11:00:00Thu 10:59:5960
Thu 11:00:00Mon 10:59:59

20

 

 

Each row represent an order, which I have the information of: Payment Date, Number of Articles, Billing Date and So on. I already converted the payment date to a cycle, by following the structure in the table ahead. 

 

Now, I have these columns: [Cycle] (Text), [PaymentWeekDay] (Text), [PaymentDay (only day in date format)]. I need the limit date where each order correspond to a cycle. Example: If an order was payed today (31/12/2020)  my limit date is 04/01/2021 - cycle 20. 

 

I'm following this formula but I still have blanks: 


=SWITCH(TRUE();Table[Cycle]="Cycle 40"&&Table[PaymentWeekDay]="monday";DATEADD(Table[PaymentDay];+2;DAY);[Cycle]="Cycle 40"&&Table[PaymentWeekDay]="tuesday";DATEADD(Table[PaymentDay];+1;DAY);[Cycle]="Cycle 50"&&Table[PaymentWeekDay]="tuesday";DATEADD(Table[PaymentDay];+2;DAY);Table[Cycle]="Cycle 50"&&Table[PaymentWeekDay]="wednesday";DATEADD(Table[PaymentDay];+1;DAY);Table[Cycle]="Cycle 60"&&Table[PaymentWeekDay]="wednesday";DATEADD(Table[PaymentDay];+2;DAY);Table[Cycle]="Cycle 60"&&Table[PaymentWeekDay]="thrusday";DATEADD(Table[PaymentDay];+1;DAY);Table[Cycle]="Cycle 20"&&Table[PaymentWeekDay]="thrusday";DATEADD(Table[PaymentDay];+4;DAY);Table[Cycle]="Cycle 20"&&Table[PaymentWeekDay]="friday";DATEADD(Table[PaymentDay];+3;DAY);Table[Cycle]="Cycle 30"&&Table[PaymentWeekDay]="friday";DATEADD(Table[PaymentDay];+4;DAY);Table[Cycle]="Cycle 30"&&Table[PaymentWeekDay]="saturday";DATEADD(Table[PaymentDay];+3;DAY);Table[Cycle]="Cycle 30"&&Table[PaymentWeekDay]="sunday";DATEADD(Table[PaymentDay];+2;DAY);Table[Cycle]="Cycle 30"&&Table[PaymentWeekDay]="monday";DATEADD(Table[PaymentDay];+1;DAY);0)

 

Any Ideas?

3 REPLIES 3
lbendlin
Super User
Super User

Have a look at the TREATAS() function.  It might help you to apply your filters more economically.

lbendlin
Super User
Super User

I assume "thrusday"  is just a typo?

 

Generally you will want to have a calendar/dates table in your data model so you can use Time Intelligence DAX functions rather than having to code this all manually.

 

Maybe you can supply sample data so we can assist better.

Anonymous
Not applicable

I meant thursday (I changed all of weekday entries to english) , I used a dax conversion of a date to weekday. I can't supply data, sorry...

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.