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 dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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.
User | Count |
---|---|
73 | |
72 | |
37 | |
31 | |
26 |
User | Count |
---|---|
96 | |
84 | |
43 | |
40 | |
35 |