Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I have an .xls sheet with 460000 rows, and a rather complex if statement in a added custom column.
Heres the statement:
= Table.AddColumn(#"Added Custom", "Korr_konto", each if [Konto] = "9200" and [FORMÅL] = "10; Debiterbart" then "9200a"
else if [Konto] = "9200" and [FORMÅL] <> "10; Debiterbart" and [Deb.typ] = "10; Debiterbar" then "9200b"
else if [Konto] = "9200" and [FORMÅL] <> "10; Debiterbart" and [Deb.typ] = "20; Ej debiterbar" then "9200c"
else if [Konto] = "7100" and [FORMÅL] = "10; Debiterbart" then "7100a"
else if [Konto] = "7100" and [FORMÅL] <> "10; Debiterbart" then "7100b"
else if [Konto] = "7110" and [FORMÅL] = "10; Debiterbart" then "7110a"
else if [Konto] = "7110" and [FORMÅL] <> "10; Debiterbart" then "7110b"
else if [Konto] = "7142" and [FORMÅL] = "10; Debiterbart" then "7142a"
else if [Konto] = "7142" and [FORMÅL] <> "10; Debiterbart" then "7142b"
else if [Konto] = "7143" and [FORMÅL] = "10; Debiterbart" then "7143a"
else if [Konto] = "7143" and [FORMÅL] <> "10; Debiterbart" then "7143b"
else if [Konto] = "7160" and [FORMÅL] = "10; Debiterbart" then "7160a"
else if [Konto] = "7160" and [FORMÅL] <> "10; Debiterbart" then "7160b"
else if [Konto] = "7161" and [FORMÅL] = "10; Debiterbart" then "7161a"
else if [Konto] = "7161" and [FORMÅL] <> "10; Debiterbart" then "7161b"
else if [Konto] = "7162" and [FORMÅL] = "10; Debiterbart" then "7162a"
else if [Konto] = "7162" and [FORMÅL] <> "10; Debiterbart" then "7162b"
else [Konto])
It works fine, but when I imported the rows into an Access DB and switched source I get an error message when I try to refresh the data on the "Add column" step (the data/colums/types are identical):
"DataFormat.Error: Expression too complex in query expression 'switch(
([_].[Konto] = '9200' and [_].[Konto] is not null) and ([_].[FORMÅL] = '10; Debiterbart' and [_].[FORMÅL] is not null), '9200a',
(([_].[Konto] = '9200' and [_].[Konto] is not null) and ([_].[FORMÅL] <> '10; Debiterbart' or [_].[F'.
Details:
Hovedboktrans_database.accdb"
When I shorten down the if statement to include only 14 (instead of 17) if statements it works fine.... Any ideas as to why?
@Anonymous
It seems a nested if limitation from Access end, see some typical threads. Please find more constructive advice from the dedicated Access forum.
In my opinion, you can take the workaround in above post.
I'm not sure on why it's doing this, but as a work around could you not make two columns, one looking at the first half of your statement, the other the second, returning nulls if applicable and then merge the two columns?
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
100 | |
80 | |
64 | |
58 |
User | Count |
---|---|
146 | |
110 | |
93 | |
84 | |
67 |