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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

Calculation for matching

 

 

 

 

I have 2 tables, both have month names and the same location name. However, the tables cannot be merged, nor can I create a relationship between then because of many-to-many.

As an example:

Table1 contains values representing "Downtime"

 JanuaryFebruaryMarchAprilMay
Dallas15661914337333603177
Austin2112290517273132943
Houston5645130918491167984

 

Table2 contains values representing "ScheduledTime"

 JanuaryFebruaryMarchAprilMay
Dallas21392288286131282972
Austin36493132344731113128
Houston33432622316331173111

 

I need to create a measure that would be:

 

 

 

DIVIDE( DIVIDE( SUM(TABLE1[Downtime]), SUM(TABLE2[ScheduledTime))), 60)

 

 

 

This is not working though, the resulted numers are all wrong.  If I do it manually in the calculator, I get the correct result.  

 

So for January of Dallas, my answer should be

(1566 / 2139) / 60 = .0122

I also tried creating a column in Table2 using the same calculation, and the resulted value was the same the entire way down the table. 

 

How can I calculate this accurately? 

1 ACCEPTED SOLUTION
jennratten
Super User
Super User

Hello - this is one way you can accomplish the result with Power Query...

 

Create a new table in Power Query that combines the two tables and performs the division.  

 

let
    Source = Table.NestedJoin (
        Table.UnpivotOtherColumns(Table1, {"Location"}, "Month", "Downtime"), 
        {"Location", "Month"}, 
        Table.UnpivotOtherColumns(Table2, {"Location"}, "Month", "ScheduledTime"), 
        {"Location", "Month"}, "Table", JoinKind.LeftOuter
    ),
    Expand = Table.ExpandTableColumn ( Source, "Table", {"ScheduledTime"}),
    #"Inserted Division" = Table.AddColumn(Expand, "Division", each [Downtime] / [ScheduledTime], type number)
in
    #"Inserted Division"

jennratten_1-1655730253917.png

 

 

 

View solution in original post

1 REPLY 1
jennratten
Super User
Super User

Hello - this is one way you can accomplish the result with Power Query...

 

Create a new table in Power Query that combines the two tables and performs the division.  

 

let
    Source = Table.NestedJoin (
        Table.UnpivotOtherColumns(Table1, {"Location"}, "Month", "Downtime"), 
        {"Location", "Month"}, 
        Table.UnpivotOtherColumns(Table2, {"Location"}, "Month", "ScheduledTime"), 
        {"Location", "Month"}, "Table", JoinKind.LeftOuter
    ),
    Expand = Table.ExpandTableColumn ( Source, "Table", {"ScheduledTime"}),
    #"Inserted Division" = Table.AddColumn(Expand, "Division", each [Downtime] / [ScheduledTime], type number)
in
    #"Inserted Division"

jennratten_1-1655730253917.png

 

 

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 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.

Top Solution Authors