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
leecity215
New Member

Condition formula to return a value from a different column

Hi everyone,

 

PowerBI newb here as you are about to see.

 

In my model data mode i have two seperate tables (shown below).

 

What i am trying to do is based on the column "Count" in Table A return results from Table B "ME Hours" and "Unit Numbers" based on the "Count" column and where the result from a given row sits in the "Max Integrations" column.

 

For example, May' 24 "Count" is 800. I would like to create a measure that returns 250 ME hours from Table B, as my value from Table A is above 750 Intregations but below 1000. 

 

Any guidance you can provide on how best to structure this would be most appreciated.

Thanks

 

Lee

 

Table A:

TowerDateCount
Tech ServicesJan-24500
Tech ServicesFeb-24575
Tech ServicesMar-24650
Tech ServicesApr-24725
Tech ServicesMay-24800
Tech ServicesJun-24875
Tech ServicesJul-24950
Tech ServicesAug-241025
Tech ServicesSep-241100
Tech ServicesOct-241175
Tech ServicesNov-241250
Tech ServicesDec-241325

 

Table B:

Contract NameTowerDateME HoursLot TypeUnit NumbersMax Integrations
Integration_Management_ServicesTech Services01/01/2024 125Incidents600500
Integration_Management_ServicesTech Services01/01/2024188Incidents900750
Integration_Management_ServicesTech Services01/01/2024250Incidents13801000
Integration_Management_ServicesTech Services01/01/2024313Incidents18751250
Integration_Management_ServicesTech Services01/01/2024375Incidents22501500
4 REPLIES 4
Wilson_
Solution Sage
Solution Sage

Hi leecity215,

 

If you're trying to add a calculated column to TableA, try:

ME Hours =
VAR Filtered =
FILTER (
    TableB,
    TableB[Max Integrations] >= TableA[Count]
)
VAR Result =
MINX (
    Filtered,
    TableB[ME Hours]
)

RETURN Result

 

----------------------------------
If this post helps, please consider accepting it as the solution to help other members find it quickly. Also, don't forget to hit that thumbs up and subscribe! (Oh, uh, wrong platform?)

 

P.S. Need a more in-depth consultation for your Power BI data modeling or DAX issues? Feel free to hire me on Upwork or DM me directly on here! I would love to clear up your Power BI headaches.

Hi there, this worked really well. The only issue is that it only returned a result for one row of data, the first row? Could it be because in table B in my model i am just showing the year whereas in table i am showing a long dat format dd/mm/yyyy? Thank you very much for your help. 

@Wilson_ Thanks for your contribution on this thread.

Hi @leecity215 ,

It will return the expected result after creating the calculated column in table A which provide by @Wilson_ , please check the below screenshot. What do you mean that it only returned a result for one row of data, the first row? Could you please provide more sample data and expected result with the logic and specific examples? It is better if you can provide the sample pbix file(exclude the sensitive info) just as suggested by @Wilson_ . Thank you.

How to upload PBI in Community

vyiruanmsft_0-1713422838892.png

Best Regards

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

leecity,

 

Can you please share a sample pbix file? (If you don't know how, please check the pinned thread in the forum.) It would make debugging your issue easier. 🙂

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.