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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
tvaishnav
Helper IV
Helper IV

DAX help

 

Hello everyone,

 

I have a following model in SSAS.

 

powerbipng.png

 

I want to add a new calculated column to Phase Totals table. Both the tables Phase totals and Job totals have a column called Job Number. I want to pull Cost from Job Total tables into Phase totals where there is a Job number match. How should I go about it? 

4 REPLIES 4
jtownsend21
Responsive Resident
Responsive Resident

Can you change the relationship between Job Totals and Data to be birectional? If so, you can create the following measure on your Phase Totals Table: 

Job Totals Cost =
    SUM('Job Totals'[Cost])

If that isn't an option then you can try a lookup like so: 

Job Totals Cost = 
LOOKUPVALUE(
    SUM('Job Totals'[Cost]),
    'Job Totals'[Job Number],
    'Phase Totals'[Job Number]
)

However I am not sure about using a sum in a lookupvalue. You may need to use the CALCULATETABLE function, but I have not used that before. 

I modified the lookup formula that you gave and tried using it.

 

=LOOKUPVALUE(
    'Job Totals'[Cost],
    'Job Totals'[Job Number],
    'Phase Totals'[Job Number]
)

This worked okay except that I have a few blanks. I have multiple instances of the Job Number in Phase Totals table. Lookup is able to pull Cost from Job totals for all the repeated instances (it will be same value) but leaves some of those blanks. Can you think of any reason why I might be getting blanks?

That's odd... Can I assum that all the Job Numbers on the Phase table are also on the Job Totals table? 

Yes. You can assume that.

 

In fact, it started working fine once I changed the relationship as follows. 2019-05-28 12_14_24-Historical_Cost_Analysis - Microsoft Visual Studio.png

 

Any ideas why?

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.