Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi
I have two tables and need to a column depending on the related column.
Context is: Trucks do runs and each run can have multiple dockets. Each docket has a weight.
relationship is
One JobRuns[RUN_ID] connects to many JobRunDocket[DOC_RUN_ID]
There can be single or multiple dockets under each run.
I want to lookup the DOC_WEIGHT and add the numbers together if there are multiples and then show the data in the JobRuns table
looking around I think something like sumx(related) might work but just can't get the formula to work.
Cheers in advance for all the help.
Rgds - ED
Solved! Go to Solution.
Hi ED,
According to your description, you need to add a calculated column to dispaly the total WEIGHT for each RUN_ID, right?
If that is the case, you can sum up the taotal value based on DOC_RUN_ID IN JobRunDocket table using CALCULATE function, and then use LOOKUPVALUE in JobRuns table.
SumByID = CALCULATE(SUM(JobRunDocket[DOC_WEIGHT]),ALLEXCEPT(JobRunDocket,JobRunDocket[DOC_RUN_ID]))
SumID = LOOKUPVALUE(JobRunDocket[SumByID],JobRunDocket[DOC_RUN_ID],JobRuns[RUN_ID])
Regards,
Charlie Liao
In your case Job Runs can be a dimension table and Job Run Docket can be a fact table. You can create a relationship between DOC_RUN_ID in JobRunDocket to RUN_ID in JobRuns.
Create a new mewasure named Total Run Weight = SUM([DOC_WEIGHT]) in JobRunDocket table in Power BI.
You should be able to slice the Total Run Weight by RUN_ID from JobRuns table.
Hi ED,
According to your description, you need to add a calculated column to dispaly the total WEIGHT for each RUN_ID, right?
If that is the case, you can sum up the taotal value based on DOC_RUN_ID IN JobRunDocket table using CALCULATE function, and then use LOOKUPVALUE in JobRuns table.
SumByID = CALCULATE(SUM(JobRunDocket[DOC_WEIGHT]),ALLEXCEPT(JobRunDocket,JobRunDocket[DOC_RUN_ID]))
SumID = LOOKUPVALUE(JobRunDocket[SumByID],JobRunDocket[DOC_RUN_ID],JobRuns[RUN_ID])
Regards,
Charlie Liao
Thanks! Works like a charm. Splitting it into two seperate calculations was a great idea.
Thanks heaps.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
63 | |
59 | |
56 | |
38 | |
29 |
User | Count |
---|---|
82 | |
62 | |
45 | |
41 | |
40 |