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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
rodrigorfsilva
Frequent Visitor

Measure based on different relationships (Differente fields in the same table)

Hi all,

 

I'm looking for a solution since last week, but couldn't find it yet. I have a fact table (TableSales) and a project table (TableProjects) as follows:

 

 

TableSales

Customer;Product;SalesDate;NetSales;Project_1;Project_2;Project_3
Energy Co;Smart Meter;07/15/19;750.000;Com. RF;;
Energy Co;Smart Meter;10/20/19;1.350.000;Com. RF;;
Energy Co;Smart Meter 2.0;06/10/19;1.350.000;Com. 4G;Anti Theft;
Energy Co;Mechanical Meter;10/30/19;1.500.000;Anti Theft;;
State Co;Smart Meter;05/15/19;900.000;Com. RF;;
State Co;Smart Meter;01/10/20;900.000;Com. RF;;
State Co;Smart Meter 2.0;09/10/19;1.050.000;Com. 4G;Anti Theft;
State Co;Smart Meter 2.0;01/02/20;1.350.000;Com. 4G;Anti Theft;
State Co;Smart Meter 3.0;08/20/19;1.350.000;Com. 4G;Cloud DG;Anti Theft

 

TableSales.PNG

 

TableProjects

ProjectID;StartDate;EndDate;Investment
;;;
Com. RF;04/01/19;09/30/19;150.000
Com. 4G;07/01/19;12/31/19;250.000
Cloud DG;07/01/19;03/31/20;350.000
Anti Theft;04/01/19;06/30/19;125.000

 

TableProjects.PNG

 

Output.PNG

 

 

 

 

 

 

 

 

 

 

 

 

I need to show the NetSales depending on each project. What happens is that I may need one, two or three projects at once. I need to show in my report the earliest StartDate; latest EndDate and the the sum of Investment.

 

I don't know how to make a relationship between my two tables, since I need to use all of three project dependency columns form TableSales and connect them with ProjectID in projects table.

 

Thank you all for your support.

 

Regards,

Rodrigo

1 ACCEPTED SOLUTION
v-chuncz-msft
Community Support
Community Support

@rodrigorfsilva,

 

You may try Unpivot Columns in Query Editor or USERELATIONSHIP in DAX.

Community Support Team _ Sam Zha
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

3 REPLIES 3
v-chuncz-msft
Community Support
Community Support

@rodrigorfsilva,

 

You may try Unpivot Columns in Query Editor or USERELATIONSHIP in DAX.

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

Nope, not clear. Sample data would help along with expected results. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Thank you Greg for your advice. This is the first time I'm sending a question here. Sorry for didn't make it clear ate first. Hope it is better now.

 

Rgds, Rodrigo

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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

Top Kudoed Authors