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
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


@ 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...

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
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.