Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi PowerBI community,
I am a beginner with PowerBI and would like to implement a calculation with condition based on two fact tables.
My current data model looks as below:
The goal here is to get the multiplication results of Rates[Bill Rate] * Actual_Planned[Actual_Hour]
based on the condition of Actual_Planned[Date] within the period defined in Rates table, i.e. Rates[Start] <= Actual_Planned[Date] <= Rates[End]
Below methods have been tried out but without success:
1. Dax: create a measure as below
Rate = CALCULATE(SUM(RELATED(Rate[Bill Rate])*'Actual_Planned[Actual_Hour]),
FILTER(ALL('Actual_Planned'),'Actual_Planned'[Date] <= RELATE('Rate'[END]) &&
'Actual_Planned'[Date] >= RELATED('Rate'[START])))
2. Power Query: merge the two table by Enterprise ID & Role.
However, it looks like Power Query does not allow filter out the rows with column value comparison, i.e. Rates[Start] <= Actual_Planned[Date] <= Rates[End]
I am looking very forward to your input. Any suggestions are welcome.
Thanks a lot for your time.
hi @Iris_ ,
try this:
Rate = CALCULATE(SUMX('Actual_Planned'),(RELATED(Rate[Bill Rate])*'Actual_Planned[Actual_Hour]),
FILTER(ALL('Actual_Planned'),'Actual_Planned'[Date] <= RELATED('Rate'[END]) &&
'Actual_Planned'[Date] >= RELATED('Rate'[START])))
Appreciate a thumbs up if this helps.
Please accept this as the solution if the query is resolved.
Should you itereate over "Master_Employee" Table?
Try [...]SUMX('Master_Employee')[...]
Hey @adudani
thanks a lot for help to check! Unfortunately, it still shows the error with RELATED(...).
I am not sure if there can be an issue with the relationships in the data model. 🤔
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
76 | |
76 | |
55 | |
37 | |
34 |
User | Count |
---|---|
99 | |
56 | |
51 | |
44 | |
40 |