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
cristianj
Helper IV
Helper IV

Dax getting value from non related table

Hello, i am new to PBI , and i have the next situation, 

i have 2 tables that look like:

id

created_at

and

idpriceexpired_at

 

for each id in first table, i have multiple entry in the second table, 

i want to add to the first table a field price in which i have the price from the second table, which was active at the created moment.

Thank you

5 REPLIES 5
v-henryk-mstf
Community Support
Community Support

Hi @cristianj ,

 

Is it possible to provide screenshots of test data and desired results?

How to Get Your Question Answered Quickly - Microsoft Power BI Community


Best Regards,
Henry

cristianj_0-1649669829503.png

 

v-henryk-mstf
Community Support
Community Support

Hi @cristianj ,

 

According to your description, you can use "make this relationship inactive" for both tables, and then use the USERELATIONSHIP function to count the total value corresponding to the id field.

vhenrykmstf_0-1649661896087.png

Measure = CALCULATE(SUM(Table2[Value]),USERELATIONSHIP(Table1[ID],Table2[ID]))

vhenrykmstf_1-1649661956217.png

 


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.

Hello 

i did not find the answer

First table in which i want to get the price from the second contains the id and the moment of the order, 

and in the second i have the id, the price and one more column named expired_at (which says till that moment the price was valid), i want to every lines from the first to get the price which was valid at the moment i made the order in 1 table so i want to get from table 2 the last record which expired_at is smaller then the expired_At value

 

CALCULATE(FirstNONBLANK(price_updates[buy_price],1),
filter((price_updates),
orders_SM[ModelShapeId]=price_updates[ModelShapeId] && orders_SM[order_date] < price_updates[expired_at])) i write this, but it not return the correct price

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.