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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Switto
Helper IV
Helper IV

creating quarters from Period

Hi All,

 

I am trying to get the Quater no. from my calendar table.

 

I am using below formula but getting error, stating "Cannot convert value 'P2' of type Text to type True/False.".

 

FY QTR = 'EY calendar'[Date].[Year]&"-Q"&IF('EY calendar'[Period]="P1"||"P2"||"P3",1,'EY calendar'[Date].[Year]&"-Q"&IF('EY calendar'[Period]="P4"||"P5"||"P6",2,'EY calendar'[Date].[Year]&"-Q"&IF('EY calendar'[Period]="P7"||"P8"||"P9",3,4)))

 

DatePeriod
02 July 2021P12
01 July 2021P12
30 June 2021P12
29 June 2021P12
28 June 2021P12

 

Request your help on this.

Thanks

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Switto , Try like

 

FY QTR = 'EY calendar'[Date].[Year]&"-Q"&IF('EY calendar'[Period] in {"P1","P2","P3"},1,'EY calendar'[Date].[Year]&"-Q"&IF('EY calendar'[Period] in {"P4","P5","P6"},2,'EY calendar'[Date].[Year]&"-Q"&IF('EY calendar'[Period] in {"P7","P8","P9"},3,4)))

 

Better try Switch

FY QTR = 'EY calendar'[Date].[Year]&"-Q"& 
Switch( true() , 
'EY calendar'[Period] in {"P1","P2","P3"},1,
'EY calendar'[Period] in {"P4","P5","P6"},2,
'EY calendar'[Period] in {"P7","P8","P9"},3,4)

 

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

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@Switto , Try like

 

FY QTR = 'EY calendar'[Date].[Year]&"-Q"&IF('EY calendar'[Period] in {"P1","P2","P3"},1,'EY calendar'[Date].[Year]&"-Q"&IF('EY calendar'[Period] in {"P4","P5","P6"},2,'EY calendar'[Date].[Year]&"-Q"&IF('EY calendar'[Period] in {"P7","P8","P9"},3,4)))

 

Better try Switch

FY QTR = 'EY calendar'[Date].[Year]&"-Q"& 
Switch( true() , 
'EY calendar'[Period] in {"P1","P2","P3"},1,
'EY calendar'[Period] in {"P4","P5","P6"},2,
'EY calendar'[Period] in {"P7","P8","P9"},3,4)

 

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

Thanks Amit, It worked. I have changed the column FY QTR to text and it worked.

Thanks for the input.

Thanks for the update. Can you accept a solution?

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

Thanks for the quick reply. However, It showing different error. 
"Function 'CONTAINSROW' does not support comparing values of type True/False with values of type Text. Consider using the VALUE or FORMAT function to convert one of the values."

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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
Top Kudoed Authors