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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
rachaelwalker
Resolver III
Resolver III

Conditional Lookup on a related table

I wanting to pull data from one column into a new one based on information from another column in another table. Here is an example of my tables. I want a new Utilized Hours column to populate "Actual Hours" if it is flagged utilized. Same concept for Non-Utilized

 

2021-05-24 10_09_51-Book1 - Excel.png

 

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@rachaelwalker I screwed up, get rid of the first ) in your IF statement and should be good to go.


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

5 REPLIES 5
Greg_Deckler
Super User
Super User

@rachaelwalker I screwed up, get rid of the first ) in your IF statement and should be good to go.


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

That worked!! Thank you so much!

Greg_Deckler
Super User
Super User

@rachaelwalker If I understand this correctly, you could add columns like the following:

Utilized Hours Column =
  VAR __WorkTypeID = [WorkTypeID]
  VAR __UtilizationFlag = MAXX(FILTER('WorkType',[WorkTypeID]=__WorkTypeID),[UtilizationFlag])
RETURN
  IF(__UtilizationFlag),[ActualHours],0)


Non-Utilized Hours Column =
  VAR __WorkTypeID = [WorkTypeID]
  VAR __UtilizationFlag = MAXX(FILTER('WorkType',[WorkTypeID]=__WorkTypeID),[UtilizationFlag])
RETURN
  IF(__UtilizationFlag),0,[ActualHours])


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

I was thinking I could do LOOKUPVALUE and pull UtilizationFlag (true or false) into the TimeEntries table. Then did an If statement but the numbers are not reflecting accurately. 

Lookup formula

Utilization = LOOKUPVALUE(WorkTypes[WorkTypes.utilizationFlag], WorkTypes[WorkTypes.id], TimeEntries[TimeEntries.workType.id])

If statement

Utilized Hours = IF('TimeEntries'[Utilization] = "True", TimeEntries[TimeEntries.actualHours], 0)

@Greg_Deckler Not sure if I am plugging the correct tables in per your response. I am getting a syntax error.

2021-05-24 13_18_13-Utilization and Backlog Analysis PC - Power BI Desktop.png

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors