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
M_SBS_6
Helper V
Helper V

The Syntax ',' is incorrect

Hi, I am trying to create a new Quarter column based on the following log below, but seem to be getting the incorrect syntax to enbale this to work. I have tried mutliple things, but just can't work out how to resolve. 

quarter_financial_years = VAR __M = MONTH ( comp[comp_date] )
RETURN

if(isblank(comp[comp_date]), blank(),

if(comp[comp_fy_start_month_no] = 7,
__M IN {7,8,9} , "Q1",
__M IN {10,11,12} ,"Q2",
__M IN {1,2,3} , "Q3",
__M IN {4,5,6} , "Q4"),

if(comp[comp_fy_start_month_no] = 4,
__M IN {4,5,6} , "Q1",
__M IN {7,8,9} , "Q2",
__M IN {10,11,12} , "Q3",
__M IN {1,2,3} , "Q4"),

if(comp[comp_fy_start_month_no] = 10
__M IN {10,11,12} , "Q1",
__M IN {1,2,3} , "Q2",
__M IN {4,5,6} , "Q3",
__M IN {7,8,9} , "Q4") ))

2 ACCEPTED SOLUTIONS
mangaus1111
Solution Sage
Solution Sage

Hi @M_SBS_6 ,

delete these 2 commas

mangaus1111_0-1667992303356.png

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

 

View solution in original post

Greg_Deckler
Super User
Super User

@M_SBS_6 Try:

 

quarter_financial_years = 
VAR __M = MONTH ( comp[comp_date] )
RETURN 
SWITCH(TRUE(),
isblank(comp[comp_date]), blank(),
comp[comp_fy_start_month_no] = 7 && __M IN {7,8,9} , "Q1",
comp[comp_fy_start_month_no] = 7 && __M IN {10,11,12} ,"Q2",
comp[comp_fy_start_month_no] = 7 && __M IN {1,2,3} , "Q3",
comp[comp_fy_start_month_no] = 7 && __M IN {4,5,6} , "Q4"),

comp[comp_fy_start_month_no] = 4 && __M IN {4,5,6} , "Q1",
comp[comp_fy_start_month_no] = 4 && __M IN {7,8,9} , "Q2",
comp[comp_fy_start_month_no] = 4 && __M IN {10,11,12} , "Q3",
comp[comp_fy_start_month_no] = 4 && __M IN {1,2,3} , "Q4"),

comp[comp_fy_start_month_no] = 10 && __M IN {10,11,12} , "Q1",
comp[comp_fy_start_month_no] = 10 && __M IN {1,2,3} , "Q2",
comp[comp_fy_start_month_no] = 10 && __M IN {4,5,6} , "Q3",
comp[comp_fy_start_month_no] = 10 && __M IN {7,8,9} , "Q4"
)

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
Greg_Deckler
Super User
Super User

@M_SBS_6 Try:

 

quarter_financial_years = 
VAR __M = MONTH ( comp[comp_date] )
RETURN 
SWITCH(TRUE(),
isblank(comp[comp_date]), blank(),
comp[comp_fy_start_month_no] = 7 && __M IN {7,8,9} , "Q1",
comp[comp_fy_start_month_no] = 7 && __M IN {10,11,12} ,"Q2",
comp[comp_fy_start_month_no] = 7 && __M IN {1,2,3} , "Q3",
comp[comp_fy_start_month_no] = 7 && __M IN {4,5,6} , "Q4"),

comp[comp_fy_start_month_no] = 4 && __M IN {4,5,6} , "Q1",
comp[comp_fy_start_month_no] = 4 && __M IN {7,8,9} , "Q2",
comp[comp_fy_start_month_no] = 4 && __M IN {10,11,12} , "Q3",
comp[comp_fy_start_month_no] = 4 && __M IN {1,2,3} , "Q4"),

comp[comp_fy_start_month_no] = 10 && __M IN {10,11,12} , "Q1",
comp[comp_fy_start_month_no] = 10 && __M IN {1,2,3} , "Q2",
comp[comp_fy_start_month_no] = 10 && __M IN {4,5,6} , "Q3",
comp[comp_fy_start_month_no] = 10 && __M IN {7,8,9} , "Q4"
)

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
mangaus1111
Solution Sage
Solution Sage

Hi @M_SBS_6 ,

delete these 2 commas

mangaus1111_0-1667992303356.png

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

 

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.