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.
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]))
```
Use a proper data model for this, rather than LOOKUPVALUE. Alternatively push the calculations upstream into Power Query.
User | Count |
---|---|
25 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
27 | |
13 | |
11 | |
9 | |
6 |