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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Iris_
Frequent Visitor

How to calculate multiplication results from two fact tables, based on date within a period

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:

Iris__0-1673183034608.png

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

 

However, it shows the columns cannot be found the the parameter type is not correct
Iris__1-1673183712526.png

 

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.

 

3 REPLIES 3
adudani
Super User
Super User

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.

Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a Kudos 🙂
Kind Regards,
Avinash

Should you itereate over "Master_Employee" Table?

Try [...]SUMX('Master_Employee')[...]

Iris_
Frequent Visitor

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

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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