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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Measure based on two relationships

Hello,

 

I have datamodel with two tables: factValues and dimDate. There are 2 relationships between the tables. 

KamilSzpyrka_2-1641901150742.png

 

KamilSzpyrka_1-1641901031030.png

I want to create a measure, which will sum Value for each date by looking if it's between DateFrom and DateTo. My idea was to create measure as below, which unfortunetly does not work, because it consider only active relationship. 

 

 

Wartość Brutto Magazyn = 
CALCULATE (
    SUM ( WAP_fStanMagazynowy[wartoscNaDzienBrutto] ),
    AND(dDate[Date] >= MIN ( WAP_fStanMagazynowy[DataFrom] ),
   dDate[Date] <= MAX ( WAP_fStanMagazynowy[DataTo] ))
)

 

Any advice? Many Thanks, Kamil

 

 

 

 

1 ACCEPTED SOLUTION

@Anonymous , the second link should have worked. That was measure-based, File for a table-based solution using my data, refer if that can help. Do not allocate 

 

file attached after signature

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@Anonymous , the expected output is not clear. Need  example

but refer

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970

 

or

 

https://community.powerbi.com/t5/Community-Blog/How-to-divide-distribute-values-between-start-date-or-end-date/ba-p/1503785

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Expected result is equivalent of the excel formula below, also presented on screen. (@Date is column J).

=SUMIFS(E:E;C:C;"<="&[@Date];D:D;">="&[@Date])

 

KamilSzpyrka_1-1641902112392.png

 

 

 

@Anonymous , the second link should have worked. That was measure-based, File for a table-based solution using my data, refer if that can help. Do not allocate 

 

file attached after signature

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Thanks Amit,

helpful as always, huge cheers! 🙂

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.