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
pbi_m1
Frequent Visitor

Aggregation over LOOKUPVALUES

Hi,

 

I wonder how to best solve the following problem: There are 2 tables:

table A with columns: DATE (date), GROUP (string), ID (int), PRICE(float)

table B with columns: ID (int), FACTOR (float)

 

FACTOR is a date-independent but ID specific number. PRICE is a date-specific and ID-specific number. GROUP is a grouping over IDs. The IDs in both tables can be used to join the tables i.e. A.ID = B.ID 

 

I'd like to create a 'Table' Visualisation in Power BI to show the following columns for a DATE that is set by a slicer:

 

GROUP, SUM(FACTOR for all IDs in this GROUP), SUM( PRICE * FACTOR for all IDs in this GROUP) 

 

I have managed to build the above by creating a new column in table A FACTOR = LOOKUPVALUES(B[FACTOR], B[ID], A[ID]) I wondered if there is a way around this extra lookup since in reality I have like 5 'FACTOR' columns and a lot of DATEs which creates a lot of data.

1 ACCEPTED SOLUTION

Hi Greg, thanks for the link. I guess my databases was big so I thought describing a simplified version of it would be easier to understand. After another hour of googling I found I think the better way that I was looking for which is (column-by-column) in the 'Table' visualisation:

GROUP,

Measure1 = SUMX( A, RELATED(B[FACTOR]) ),

Measure2 = SUMX( A, A[PRICE] * RELATED(B[FACTOR]))

 

View solution in original post

2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

That's lots of words. Sample data with an example of what you want as output is much easier to understand. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Hi Greg, thanks for the link. I guess my databases was big so I thought describing a simplified version of it would be easier to understand. After another hour of googling I found I think the better way that I was looking for which is (column-by-column) in the 'Table' visualisation:

GROUP,

Measure1 = SUMX( A, RELATED(B[FACTOR]) ),

Measure2 = SUMX( A, A[PRICE] * RELATED(B[FACTOR]))

 

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.