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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
InukBot
New Member

Power Query-editor and i want to avoid using import mode

First of all, sorry for the bad english, not my first language.

I am very new to Power BI and I want to make a map that devides Denmark op into the regions. I was told to use Power Query-editor to get a column that says the name of the region, but i was told not to use import mode to help

I have used this to make sure that it will divide the regoins by using the postalcodes. the code I have come up with so far is this:

 

let changeZero = if [PostalCode] = "null" or [PostalCode] = null then "0" else [PostalCode],

postalCode = Number.FromText(changeZero)

in

if postalCode >= 1000 and postalCode <= 2999 then "Storkøbenhavn"

else if postalCode >= 3000 and postalCode <= 3699 then "Nordsjælland"

else if postalCode >= 4000 and postalCode <= 4999 then "Vest/sydsjælland"

else if postalCode >= 5000 and postalCode <= 5999 then "Fyn"

else if postalCode >= 6000 and postalCode <= 6799 then "Sønderjylland"

else if postalCode >= 6800 and postalCode <= 7699 then "Storkøbenhavn"

else if postalCode >= 7700 and postalCode <= 7999 then "Nordjylland"

else if postalCode >= 8000 and postalCode <= 8999 then "Østjylland"

else if postalCode >= 9000 and postalCode <= 9999 then "Nordjylland"

else "Ikke i Danmark"

 

Many thanks.

1 ACCEPTED SOLUTION
edhans
Super User
Super User

You cannot do it with Number.FromText. That won't fold and only functions that fold can be used with direct import. Off the top of my head I am not aware of a way to convert text to a number and it still fold. Can you have a view written on your server that does that for you first?

 

For reference, here is a good list of functions and whether or not they fold, which is absolutely necessary for a model that uses Direct Query. The (Almost) Definitive Guide to Query Folding - It's Not About The Cell (itsnotaboutthecell.com)



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

2 REPLIES 2
InukBot
New Member

Thank you very much for the help! 

edhans
Super User
Super User

You cannot do it with Number.FromText. That won't fold and only functions that fold can be used with direct import. Off the top of my head I am not aware of a way to convert text to a number and it still fold. Can you have a view written on your server that does that for you first?

 

For reference, here is a good list of functions and whether or not they fold, which is absolutely necessary for a model that uses Direct Query. The (Almost) Definitive Guide to Query Folding - It's Not About The Cell (itsnotaboutthecell.com)



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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