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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
devika
Helper II
Helper II

Quarter Elapsed

Hi,

 

I was wondering if it is possible to create a 'Quarter Elapsed column' as a calculated column for each row based on the latest Year and Quarter.

Extracted year and quarter out of case date.

If  2022,4 (Year - 2022  Quarter - 4) is the latest quarter, then the quarter elapsed is 0,

then 2022,3 quarter elapsed is 1,

then 2022,2 quarter elapsed is 2,

then 2022,1 quarter elapsed is 3,

then 2021,4  quarter elapsed is 4.

Fdevika_1-1676505065307.png

 

Thanks for your help.

 

 

2 REPLIES 2
amitchandak
Super User
Super User

@devika , Try new column like

 

var _date = Date([Year], 3*[Quarter],1)
var _qtr_st = mod(month(_date),3)
return eomonth(_date, -1*Switch(_rem,0,3,_rem))+1
var _qtr_today = mod(month(today()),3)
return eomonth(today(), -1*Switch(_rem,0,3,_rem))+1
return
datediff(_qtr_st,_qtr_today,quarter)

Thanks, @amitchandak,

 

What does _rem need to be defined as?

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.