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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. 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
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.