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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
MKPartner
Helper I
Helper I

Conditional column valid to specific period of time

Hello, 

 

I need some help. I have below conditional colum. 

 

= Table.AddColumn(#"Rozwinięty element QR7", "QR7.shift.SQL", each if [QR7.shift] = "A" then "C" else if [QR7.shift] = "B" then "A" else if [QR7.shift] = "C" then "B" else [QR7.shift])

 

This code is valid for only until Year = 2023, Month = P03 & Week = WK09. Since Week 10 above code was fixed on SQL server. I don't need this anymore for further data but I need this code for past data.

Can you help me how to tweak his code to be valid only until week 09 2023 ? 

 

Thank you 

1 ACCEPTED SOLUTION

Again thanks for feedback. I have modified you code to below & it solved my issue: 

 

= Table.AddColumn(#"Rozwinięty element QR7", "QR7.shift.SQL", each if[WC_Date]>"2023P03WK09" then [QR7.shift] else if [QR7.shift] = "A" then "C" else if [QR7.shift] = "B" then "A" else if [QR7.shift] = "C" then "B" else [QR7.shift])

View solution in original post

3 REPLIES 3
wdx223_Daniel
Super User
Super User

= Table.AddColumn(#"Rozwinięty element QR7", "QR7.shift.SQL", each if[Year]>=2023 and [Week]>="WK 09" then QR7.shift] else if [QR7.shift] = "A" then "C" else if [QR7.shift] = "B" then "A" else if [QR7.shift] = "C" then "B" else [QR7.shift])

Again thanks for feedback. I have modified you code to below & it solved my issue: 

 

= Table.AddColumn(#"Rozwinięty element QR7", "QR7.shift.SQL", each if[WC_Date]>"2023P03WK09" then [QR7.shift] else if [QR7.shift] = "A" then "C" else if [QR7.shift] = "B" then "A" else if [QR7.shift] = "C" then "B" else [QR7.shift])

Thanks for feedack. I have copied & pasted your code & I have below error: 

 

Error.JPG

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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

Top Solution Authors