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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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/

Inogic Professional Services: Power Platform/Dynamics 365 CRM
An expert technical extension for your techno-functional business needs
Drop an email at crm@inogic.com
Service: https://www.inogic.com/services/
Tips and Tricks: https://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/

Inogic Professional Services: Power Platform/Dynamics 365 CRM
An expert technical extension for your techno-functional business needs
Drop an email at crm@inogic.com
Service: https://www.inogic.com/services/
Tips and Tricks: https://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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.