Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi everyone,
Currently i'm stuck with the following requirements:
I need to calculate the correct value of column [DirectUnitCost] based on each [ProductionOrderFK] the following condition:
If a transaction in table Fact_ValueEntry has a PostingDate that comes in the range between [StartingDate] en [EndingDate], then show the value of [DirectUnitCost], otherwise null.
For example: the correct value of column [DirectUnitCost] for ItemFK : MXM30.0780 thats created on 30/4/2020 would be 1,57.
Many to Many on ItemPK : ItemPK
Fact_ValueEntry
Dim_PurchasePrice
What would be a good Measure in this case?
Kind Regards,
Regazzi
Solved! Go to Solution.
Hi @rsanyoto ,
Many to Many relationship is always troublesome.
You'd better create a dim table between the 2 tables which is using 1:M relatioship to connect the 2 tables and get the DirectUnitCost values.
Best Regards,
Kelly
Did I answer your question? Mark my reply as a solution!
Has anyone a better suggestions? Kind regards
@rsanyoto , you can create a flag column in first table
New col =
var _cnt = countx(filter(Table2, Table1[Posting Date]>= Table2[Start Date] && Table1[Posting Date]<= Table2[End Date] )), Table2[Item FK])
return
if(Isblank(_cnt), false(), true())
hI @amitchandak ,
the option you gave me doesnt meet my requirements. it's because the expected output must not be a true/false but a number.
Please see the following table as a expected result
| ProductionOrderFK | ItemFK | PostingDate | StartingDate | EndingDate | DirectUnitCost |
| VPO-200776 | MXM30.0780 | 30/04/2020 | 01/04/2020 | 31/08/2020 | 1,57 |
The 1,57 amount is created becasue there was a transaction on 30th april and thats a date between period of 01 april and 31 of augustus.
Hi @rsanyoto ,
Many to Many relationship is always troublesome.
You'd better create a dim table between the 2 tables which is using 1:M relatioship to connect the 2 tables and get the DirectUnitCost values.
Best Regards,
Kelly
Did I answer your question? Mark my reply as a solution!
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 58 | |
| 45 | |
| 40 | |
| 21 | |
| 18 |