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
lee_a
Frequent Visitor

Custom Week Calendar: Creating WTD/MTD Columns and Prior Year WTD/MTD Columns

Hello experts, 

 

I'm having trouble figuring out how to do create a prior year columns for my existing WTD and MTD columns. 

 

My calendar is a 454 Type with the fiscal year starting Feb 1 among some other weird specifics. 

 

An example of my columns giving me a "WTD" identifier is as follows (please note I'm not an analyst, just a lowly accountant trying to build some measures so my existing columns may be completely inefficient). 

 

 

Year+Week+DayThis WTDBeg.OfThisWeekThis WTD PY
2019077   
2019076   
2019075   
2019074   
2019073Week to Date  
2019072Week to Date  
2019071Week to DateWeek Start 
2019067   
2019066   
2019065   
2019064   
2019063   
2019062   
2019061   

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The above table represents the scenario in which I'm 3 days into my 7th week of the current fiscal year (2019)


Formula's for each column is as follows:

 

Year+Week+Day = CONCATENATE(Calendar_Lookup[Year+Week#],Calendar_Lookup[DayOfWeekNumber])

 

This WTD = if(and(Calendar_Lookup[Year+Week+Day] <= LOOKUPVALUE(Calendar_Lookup[Year+Week+Day],Calendar_Lookup[Date],today()-1),
Calendar_Lookup[Year+Week+Day]>=LOOKUPVALUE(Calendar_Lookup[Year+Week+Day],Calendar_Lookup[Beg.OfThisWeek],"Week Start")),"Week To Date",Blank())

 

Beg.OfThisWeek = if(and(Calendar_Lookup[This Week]="This Week",Calendar_Lookup[DayOfWeekNumber]=1),"Week Start",blank())

 

I'm trying to create a "This WTD Prior Year" column which would essentially identify the rows which are exactly 1 year previous of the Year+Week+Day value of any rows that have a "Week To Date" value in the "This WTD" column. 

 

What I would expect is that in my example above, the only rows which this formula would identify would be rows with  Year+Week+Day values of 2018073, 2018072, 2018071 - i.e. the first 3 days of the 7th fiscal week of the prior fiscal year. 

 

My attempt was as follows:

 

This WTD LY = if(Calendar_Lookup[Year+Week+Day]=LOOKUPVALUE(Calendar_Lookup[WM Year+Week+Day],Calendar_Lookup[This WTD],"Week To Date")-1000,"This WTD PY",BLANK()) however this give sme the error of "a table of multiple values was supplied where a single value was expected". I realize this is due to the use of the Lookupvalue function but I'm not sure how to get around it. 

 

I'd appreciate some help on this!

 

Thanks!

 

1 ACCEPTED SOLUTION
v-xjiin-msft
Solution Sage
Solution Sage

Hi @lee_a,

 

In your scenario, could you please share us your pbix file with OneDrive or something else if possible? So that I can dig deeper and make some proper tests.

 

Thanks,
Xi Jin.

View solution in original post

1 REPLY 1
v-xjiin-msft
Solution Sage
Solution Sage

Hi @lee_a,

 

In your scenario, could you please share us your pbix file with OneDrive or something else if possible? So that I can dig deeper and make some proper tests.

 

Thanks,
Xi Jin.

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.