cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

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
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

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

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors