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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Help with token error

Hi,

I am new to power-bi and am trying to make quite a complex model, could use some help!

I have a sales table with product and business unit data, and an expenses table with a business unit data.

I want to be able to allocate expenses by products based on the rate they constiture of the sales.

 

My relationships are as follows:Screenshot 2021-06-17 195155.png

I created a new column in the sales table with the allocation, it works great:

AllocationRate = DIVIDE(
Sales[Sales ($K)],
CALCULATE(SUM(Sales[Sales ($K)]),FILTER(Sales,Sales[Business Unit]=EARLIER(Sales[Business Unit]))))
 
And now I want to multiply the allocationrate column by the operating income, but it doesnt work.
this is my syntax:
ExpensesAllocation = ('Sales'[AllocationRate])*CALCULATE(SUM('Expenses3[Total Operating Income (Loss)])))))))))
and i get this error:
The following syntax error occurred during parsing: Invalid token, Line 1, Offset 41, 'Expenses3[Total Operating Income (Loss)])))))))))).
 
what is wrong? the relationships? the syntax? please help!
 
Thank youu
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous 

Please check the column type of your Total Operating Income (Loss) column. Here you use sum function to calculate it, this column should be in number type.

I have test by a sample model, my dax code works well and it shouldn't be relationship or synatx error.

My sample is as below.

Year :

1.png

Expense3:

2.png

Sales:

AllocationRate = DIVIDE(
Sales[$K],
CALCULATE(SUM(Sales[$K]),FILTER(Sales,Sales[Business Unit]=EARLIER(Sales[Business Unit]))))
ExpensesAllocation = ('Sales'[AllocationRate])*CALCULATE(SUM('Expenses3'[Total Operating Income (Loss)]))

3.png

Relationship:

4.png

You see my ExpensesAllocation column works well with the same relationship and show correct result. Please check whether this column is in number type in your model.

 

Best Regards,

Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Thank you!

Anonymous
Not applicable

Hi @Anonymous 

Please check the column type of your Total Operating Income (Loss) column. Here you use sum function to calculate it, this column should be in number type.

I have test by a sample model, my dax code works well and it shouldn't be relationship or synatx error.

My sample is as below.

Year :

1.png

Expense3:

2.png

Sales:

AllocationRate = DIVIDE(
Sales[$K],
CALCULATE(SUM(Sales[$K]),FILTER(Sales,Sales[Business Unit]=EARLIER(Sales[Business Unit]))))
ExpensesAllocation = ('Sales'[AllocationRate])*CALCULATE(SUM('Expenses3'[Total Operating Income (Loss)]))

3.png

Relationship:

4.png

You see my ExpensesAllocation column works well with the same relationship and show correct result. Please check whether this column is in number type in your model.

 

Best Regards,

Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors