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
BalaKiranM
Helper II
Helper II

DAX help with IF statement

Experts, please help me to convert the below SAP BI syntax in DAX. @amitchandak 

 

=If(DayNumberOfWeek([Applydate])<>7;RelativeDate([Applydate];(1-DayNumberOfWeek([Applydate]))+6);[Applydate])

 

 

Thanks,

Bala

1 ACCEPTED SOLUTION
SamInogic
Super User
Super User

Hi,

The conversion for your “=If(DayNumberOfWeek([Applydate])<>7;RelativeDate([Applydate];(1-DayNumberOfWeek([Applydate]))+6);[Applydate])" expression in DAX expression will be as follows:

ConvertedDate = If(WEEKDAY([Applydate])<>7, DATEADD([Applydate], (1-WEEKDAY([Applydate]))+6,DAY), [Applydate])

Please refer to the below screenshot for the same.

SamInogic_0-1670932075582.png

If this answer helps, please mark it as Accepted Solution so it would help others to find the solution.

Thanks!

Inogic Professional Services

An expert technical extension for your techno-functional business needs

Power Platform/Dynamics 365 CRM

Drop and email at crm@inogic.com

Service:  http://www.inogic.com/services/  

Power Platform/Dynamics 365 CRM Tips and Tricks:  http://www.inogic.com/blog/

View solution in original post

3 REPLIES 3
SamInogic
Super User
Super User

Hi,

The conversion for your “=If(DayNumberOfWeek([Applydate])<>7;RelativeDate([Applydate];(1-DayNumberOfWeek([Applydate]))+6);[Applydate])" expression in DAX expression will be as follows:

ConvertedDate = If(WEEKDAY([Applydate])<>7, DATEADD([Applydate], (1-WEEKDAY([Applydate]))+6,DAY), [Applydate])

Please refer to the below screenshot for the same.

SamInogic_0-1670932075582.png

If this answer helps, please mark it as Accepted Solution so it would help others to find the solution.

Thanks!

Inogic Professional Services

An expert technical extension for your techno-functional business needs

Power Platform/Dynamics 365 CRM

Drop and email at crm@inogic.com

Service:  http://www.inogic.com/services/  

Power Platform/Dynamics 365 CRM Tips and Tricks:  http://www.inogic.com/blog/

Thanks @SamInogic for your perfect DAX code, need to learn from you guys.

Thanks @amitchandak  for your quick response, I always tag your name when I struck in DAX and you help me couple of times.

 

Thanks again both of you @SamInogic @amitchandak 

amitchandak
Super User
Super User

@BalaKiranM , what are you trying to do there.

 

In case you need week start or end date

Week Start date = 'Date'[Date]+-1*WEEKDAY('Date'[Date],2)+1
Week End date = 'Date'[Date]+ 7-1*WEEKDAY('Date'[Date],2)

 

Any Weekday Week - Start From Any day of Week
https://community.powerbi.com/t5/Community-Blog/Any-Weekday-Week-Decoding-Date-and-Calendar-2-5-Powe...
https://medium.com/chandakamit/cheat-sheet-any-weekdays-week-start-date-just-one-variable-apart-6b2e...

 

 

The information you have provided is not making the problem clear to me. Can you please explain with an example.

Appreciate your Kudos.

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.

Top Solution Authors