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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
emilymgoitia
Helper I
Helper I

Lookup value from one column to another, or, associating x axis with specific text

Hello.

I would like to create a bar graph that explains the reasons that a scheduled date has improved.  For this example, there will be two reasons, 'dates matched' or 'pull in'.
These three columns come directly from my data source.  Comments may or may not be retained week over week.  They are generally retained until replaced.  

 

This is a paired down example of what my data looks like.

Work Week ScopeComments
11111WW09:  Pull in due to expedited shipping.
11222WW10:  Delay due to a reason.
11333WW11:  Dates aligned.
12111WW09:  Pull in due to expedited shipping.
12222WW10:  Delay due to a reason.
12333WW11:  Dates aligned.
13111WW13:  Pull in due to condensed schedule.
13222WW10:  Delay due to a reason.
13333WW11:  Dates aligned.
14111WW14: Pull in due to reasons.
14222WW14:  Dates aligned.
14333WW14: Pull in due to efficiencies.

 

This is the value that I would like to retrieve based on my example data above.

111Dates aligned
110Pull in
120Dates aligned
120Pull in
131Dates aligned
130Pull in
141Dates aligned
142Pull in

 

This is where I am with my real data.

emilymgoitia_0-1617328940246.png

I can't simply take the variance between weeks.  I believe that I need to associate the x axis with the text in the comments, or, look up in the comments for the results in the work week column.  
Any ideas?



1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

You could add a calculated column to your table like this.

Category = 
IF (
    CONTAINSSTRING('Table'[Comments],'Table'[Work Week]),
    SWITCH(
        TRUE(),
        CONTAINSSTRING('Table'[Comments],"Pull In"),"Pull In",
        CONTAINSSTRING('Table'[Comments],"Dates aligned"),"Dates aligned"
    )
)

It will populate with "Pull in" or "Dates aligned" base on the comment containing the same number as the work week and the the if it does the comment containing one of those two strings.

jdbuchanan71_0-1617333424066.png

Then you use the new Category column in your visual and filter out blanks.

View solution in original post

2 REPLIES 2
emilymgoitia
Helper I
Helper I

This worked beautifully, and seems so easy once you layed it out like that.  Thank you so much!

jdbuchanan71
Super User
Super User

You could add a calculated column to your table like this.

Category = 
IF (
    CONTAINSSTRING('Table'[Comments],'Table'[Work Week]),
    SWITCH(
        TRUE(),
        CONTAINSSTRING('Table'[Comments],"Pull In"),"Pull In",
        CONTAINSSTRING('Table'[Comments],"Dates aligned"),"Dates aligned"
    )
)

It will populate with "Pull in" or "Dates aligned" base on the comment containing the same number as the work week and the the if it does the comment containing one of those two strings.

jdbuchanan71_0-1617333424066.png

Then you use the new Category column in your visual and filter out blanks.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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