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
wpf_
Post Prodigy
Post Prodigy

I can't get a measure to show a value based on another measure's value

I have a table that show which employees are working today.  And if the employee is out, it should show the replacement's name and job number.  However I am not able to show the replacement's job number now.  

wpf__0-1611613961035.png

 

I need some help. 

Here is my sample pbix file. Thanks.

 

https://drive.google.com/file/d/1qOXRswGZD6u-ZBAphHOT16XDc9iVqUyK/view?usp=sharing

1 ACCEPTED SOLUTION
v-henryk-mstf
Community Support
Community Support

Hi @wpf_ ,


According to your requirements, I recreated a measure on the Dynamic Replacement you created. The judgment condition is to return the Job Number of the current row when the columns are the same, otherwise return the value of the Job Number corresponding to the Employee Name. The following results can be used as a reference:

Measure = 
var M_Cur_Name = [Dynamic Replacement]
 
var cur_job_Number = MAX(Employee[Job Number])
 
var job_number = CALCULATE(MAX(Employee[Job Number]), FILTER(ALL(Employee), Employee[Employee Name]= M_Cur_Name))
 
return
IF(M_Cur_Name = MAX(Employee[Employee Name]),cur_job_Number,job_number)

v-henryk-mstf_0-1612344243265.png

 

Here is the sample pbix file.


If the problem is still not resolved, please provide detailed error information and test data. Let me know immediately, looking forward to your reply.


Best Regards,
Henry


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

13 REPLIES 13
v-henryk-mstf
Community Support
Community Support

Hi,
According to your requirements, I recreated a measure on the Dynamic Replacement you created. The judgment condition is to return the Job Number of the current row when the columns are the same, otherwise return the value of the Job Number corresponding to the Employee Name. The following results can be used as a reference:

Measure = 
var M_Cur_Name = [Dynamic Replacement]
 
var cur_job_Number = MAX(Employee[Job Number])
 
var job_number = CALCULATE(MAX(Employee[Job Number]), FILTER(ALL(Employee), Employee[Employee Name]= M_Cur_Name))
 
return
IF(M_Cur_Name = MAX(Employee[Employee Name]),cur_job_Number,job_number)

v-henryk-mstf_0-1612771344958.png

 

Here is the sample pbix file.


If the problem is still not resolved, please provide detailed error information and test data. Let me know immediately, looking forward to your reply.


Best Regards,
Henry


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-henryk-mstf Thanks. I was able to get what I wanted.  I am having a better understanding now. And thanks for your example. 

v-henryk-mstf
Community Support
Community Support

Hi @wpf_ ,


According to your requirements, I recreated a measure on the Dynamic Replacement you created. The judgment condition is to return the Job Number of the current row when the columns are the same, otherwise return the value of the Job Number corresponding to the Employee Name. The following results can be used as a reference:

Measure = 
var M_Cur_Name = [Dynamic Replacement]
 
var cur_job_Number = MAX(Employee[Job Number])
 
var job_number = CALCULATE(MAX(Employee[Job Number]), FILTER(ALL(Employee), Employee[Employee Name]= M_Cur_Name))
 
return
IF(M_Cur_Name = MAX(Employee[Employee Name]),cur_job_Number,job_number)

v-henryk-mstf_0-1612344243265.png

 

Here is the sample pbix file.


If the problem is still not resolved, please provide detailed error information and test data. Let me know immediately, looking forward to your reply.


Best Regards,
Henry


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

wpf_
Post Prodigy
Post Prodigy

I have two tables:  employee and replacement.  in the table visual i have the employee job position in one column, then i have a measure that gives me the respective empoyee name tied to that job position.  The employee name changes to his replacement if the employee is out for that day.  Now I want a third column that shows the employee's ID but based on which employee is in (based on that measure).  How do you write a measure or calculated column based on which employee is listed for each row from the measure?

 

Here is the table structure:

employee: job position, employee name, employee ID

replacement: measure (to determine who is out, and who the replacement is).  

 

Thanks 

@wpf_ can you simply paste a sample data and expected output, or throw something in excel and share it thru one drive/google drive. 



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.

@parry2k Here is the pbix file. Thank you so much for helping.  So i basically want to show the job number for who ever is in the replacements column.   Here is the pbix file: https://drive.google.com/file/d/1qOXRswGZD6u-ZBAphHOT16XDc9iVqUyK/view?usp=sharing

 

 

wpf__0-1611610536633.png

 

@wpf_ could you share sample data and expected output.



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.

@parry2k Hi here is an illustration.

 

wpf__0-1611592755185.png

 

v-henryk-mstf
Community Support
Community Support

Hi @wpf_ ,


According to your requirements, I recreated a measure on the Dynamic Replacement you created. The judgment condition is to return the Job Number of the current row when the columns are the same, otherwise return the value of the Job Number corresponding to the Employee Name. The following results can be used as a reference:

 

Measure = 
var M_Cur_Name = [Dynamic Replacement]
 
var cur_job_Number = MAX(Employee[Job Number])
 
var job_number = CALCULATE(MAX(Employee[Job Number]), FILTER(ALL(Employee), Employee[Employee Name]= M_Cur_Name))
 
return
IF(M_Cur_Name = MAX(Employee[Employee Name]),cur_job_Number,job_number)

 

v-henryk-mstf_0-1611798064706.png

 

Here is the sample pbix file for reference.


If the problem is still not resolved, please provide detailed error information and let me know immediately, looking forward to your reply.


Best Regards,
Henry


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

pranit828
Community Champion
Community Champion

Hi @wpf_ 

If Jack replaced Lisa, won't lisa job number be assigned to Jack, i.e., 22222 and you would just need to use the 2nd column from your screenshot.





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile

@pranit828 @The job number stays with the employees.  Lisa will keep 2222 and jack will keep 7777.  I just want to show that if Lisa is out jack will take his place and his job number is 7777

pranit828
Community Champion
Community Champion

HI @wpf_ 

So, Jack will have same job number eventhough he is tied to different Location (B and G)





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile

@pranit828 @Yes jack can work in two locations.  Job number follows him

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.