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
Anonymous
Not applicable

IF statements to create a baseline

Hi everyone,

 

I have a dataset with ProductIDs, Subjects and the rating of life for that product. Every ProductID can only have 1 subject named 'Task A', but it can have multiple of the other subjects; Task B, Task C, etc.

 

I used the IF statement to create a column that looks for and returns the rating of life for Task A using the Add conditional column. 

 

However, I would like to have that new column to also fill in the blanks with that same Task A value based on the ProductID, so that when plotting a line graph I can create a Base line for Task A.

 

This is an example of how I am trying to make it look like in my data set:

 

ProductIDSubjectProduct rating of life

Task A Baseline

PID_0001Task A99
PID_0001Task B79
PID_0001Task B 69
PID_0001Task C79
PID_0002Task A88
PID_0002Task B 48
PID_0002Task C58
PID_0002Task C68
PID_0002

Task B

78
PID_0003Task A22
PID_0003Task C42
1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@Anonymous you can easily do this in power query, add a custom column with the following expression

 

if [Subject] = "Task A" then [Product rating of life] else null

and then from the menu, use fill down to fill the null values and that will do it.

 

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

4 REPLIES 4
parry2k
Super User
Super User

@Anonymous you can easily do this in power query, add a custom column with the following expression

 

if [Subject] = "Task A" then [Product rating of life] else null

and then from the menu, use fill down to fill the null values and that will do it.

 

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

@parry2k Thank you for the quick response.

 

I want to use something else than fill down since the ProductIDs are not sorted. We keep adding new lines in our system so when we export the excel file from our database we will not have the ProductIDs sorted. 

 

I am trying to use some sort of query that uses the fill down function but looks at the ProductIDs in the whole document to know where to fill in the Task A value.

@Anonymous you can add a step for sorting before filling down and that will take care of it.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

Thank you @parry2k that solved my problem!

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.