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

Getting some error when creating Fiscal week using custom column

Hi,

vmware-view_2CrZfo2FN9.png EXCEL_4T59F9CjYX.png

 

I want to add fiscal week condition in my exisiting report . I am trying to do that with Custom column , but it is giving me some error. Can you please help me ?

 

Example : I want to define week 1 of 2020 starts on 29-12-2019 and Ends on 04-01-2020 as per Fiscal week.

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@amitchandak ,

 

though it is not working.

vmware-view_G2DJ4iqP26.png

View solution in original post

4 REPLIES 4
v-henryk-mstf
Community Support
Community Support

Hi @Anonymous ,

 

According to the above error, it is due to the wrong syntax format used in power query, I did the following test:

if [Date] >= Date.FromText("2019-12-29") and [Date] <= Date.FromText("2020-01-04") then "Week1 2019" else if [Date] >= Date.FromText("2020-01-05") and [Date] <= Date.FromText("2020-01-11") then "Week2 2020" else "week3 2020"

v-henryk-mstf_0-1619590365307.png

 

Here is a related blog that can be used as a reference: Power Query IF ELSE and IF AND statements | Excel Quick Help


If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.

Best Regards,
Henry

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

@amitchandak ,

 

though it is not working.

vmware-view_G2DJ4iqP26.png

@Anonymous no ( after if and at end of if : )

 

if <condition> then <result1> else <result2>  .also power query case sensitive

 

refer example

https://www.myonlinetraininghub.com/power-query-if-statements

 

https://docs.microsoft.com/en-us/powerquery-m/m-spec-conditionals

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
amitchandak
Super User
Super User

@Anonymous in power query use and in place &&

 

and

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.

Top Solution Authors