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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
jzhao
Frequent Visitor

Circular reference calculated columns

I have 2 calculated columns for sales in local currency and sales in USD, the code are the same but the first works fine the second gives me Circular reference error, can anyone help me with this?

 

Step 1 created the share for a column named "share", which is done using the following code:
```
share =
VAR currentid = 'Table1'[ID]
VAR maxrevenue = MAXX(FILTER('Table1', 'Table1'[ID]=currentid), ABS('Table1'[Amount (Local currency)]))
VAR share = 'Table1'[Amount (Local currency)] / maxrevenue * 
RETURN share * 
```

 

Step2-fetch sales from table 2
I also have two other columns called "Sales USD" and "Sales Local Currency", which are calculated using the following code:
```
Sales USD = LOOKUPVALUE('Table2 list'[ Sales (USD)], 'Table2 list'[ID], 'Table1'[ID])
Sales Local Currency = LOOKUPVALUE('Table2 list'[ Sales__Local_currency], 'Table2 list'[ID], 'Table1'[ID])
```
Now, I want to multiply "Sales USD" with "share" for each row. So, I tried the following code:
```

 

Step 3- the error step
Sales Split = CALCULATE(SUMX('Table1', 'Table1'[Sales_Local_currency] * 'Table1'[share]))
```
This gives me the correct result. However, when I tried to do the same for "Sales USD", I got a circular reference error. Can you tell me why?
```
Sales Split USD = CALCULATE(SUMX('Table1', 'Table1'[Sales USD] * 'Table1'[share]))
```

1 REPLY 1
lbendlin
Super User
Super User

Use a proper data model for this, rather than LOOKUPVALUE.  Alternatively push the calculations upstream into Power Query.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.