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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

Compare Data - Different Tables & multiple Rows

Hi, 

 

I was trying to use formula previously suggested @ https://community.powerbi.com/t5/Desktop/How-to-compare-data-current-vs-previous-in-a-dynamic-table/...  but it didn't work as i expected. 

I will add a sample of my data; 

As you can see i have two related tables, unique identifier is "BK_NUMBER" for both. Data is more complicated but i share necessary parts

First i need to calculate sum of "rate" column for each "bk_number",

then two different column to show last "bk_number" total rate and previous "bk_number" total rate.

last & previous comparison should be customer basis (a customer's last order and previous order rates will be shown in different columns) 

all bk_numbers are connected to a customer (third sheet is a sample) 

 

BK_NUMBERCODECURRENCYRATE
082xxxx5606ERCUSD75
082xxxx5606CAFUSD23.09
082xxxx5606THCUSD100
082xxxx5606CSFUSD11
082xxxx5606PRMUSD18.9
082xxxx5606BRCUSD128
082xxxx5606PRSUSD75
082xxxx5606ONCUSD360
082xxxx5606FRTUSD809.01
082xxxx5607ERCUSD100
082xxxx5607PRMUSD16.83
082xxxx5607CAFUSD16.58
082xxxx5607SCSUSD25
082xxxx5607FRTUSD418.59
082xxxx5607CSFUSD11
082xxxx5607BRCUSD77
082xxxx5607DMGUSD75
082xxxx5607OCCUSD75

 

BK_NOBK_CRT_DATE
082xxxx560601-Eyl-20
082xxxx560601-Eyl-20
082xxxx560601-Eyl-20
082xxxx560601-Eyl-20
082xxxx560601-Eyl-20
082xxxx560601-Eyl-20
082xxxx560701-Eyl-20
082xxxx560701-Eyl-20
082xxxx560701-Eyl-20
082xxxx560701-Eyl-20
082xxxx560701-Eyl-20

 

BK_CUSTOMER
XYZ  LTD
ABC LTD
ZXC SA
ASD LTD

 

Capture.JPG

4 REPLIES 4
Anonymous
Not applicable

i try this formula but it doesn't work. and i can't even figure out how to find previous order data 

 

Freight Total = SUM(BK_FRT[RATE])  

 

Last Order = Sumx(filter(allselected(BK_HEADER), [BK_CUSTOMER] = max([BK_CUSTOMER]) && [BK_CRT_DATE] = max([BK_CRT_DATE])),[Freight Total])

 

really need your help @Greg_Deckler @amitchandak @Anonymous 

Anonymous
Not applicable

Hi @Anonymous,

If you want to compare current value and previous value, your table requires regular numeric/date value fields then you can use this field as index to looping records and get the corresponding previous values.

If not, you can try to enter to query editor and group with current table category fields and add index inside the groups, then you can get a valid index field for dax format calculations.

Numbering Grouped Data in Power Query 

Regards,

Xiaoxin Sheng

Anonymous
Not applicable

Hi @

 

Anonymous
Not applicable

HI @Anonymous,

Can you please share a pbix file with some dummy data to test? I test with your sample data but they can't link bk_numbers with customers correctly. BTW, you snapshot also not help to clarify the table relationships.

How to Get Your Question Answered Quickly 

Notice: please not attach the sensitive data in the sample file.

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.