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

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.

Reply
sesame5486
Frequent Visitor

How to force a line to execute in Power Query

I recently posted this question when my query would not refresh correctly. The query would only refresh correctly after I refreshed the preview.

To summarise the question and answer, the reason why the query would only refresh correctly after refreshing the preview was because one of the steps in the query was not referenced by the final step, but was essential for the API to work correctly (please see post for full details).

My question is simple: how do I force Power Query to execute a step even if that step is not referenced in the final step? To illustrate my point, how would I force Power Query to execute step "a = "123"," below?

 

let
a = "123",
b = "456"
in
b

 

1 ACCEPTED SOLUTION
slorin
Super User
Super User

Hi,

May be, 

let
a = "123",
b = "456",
Choose = (chooseFirst as logical, first, second) =>
if chooseFirst then first else second
in
Choose(false, a, b)

https://bengribaudo.com/blog/2018/02/28/4391/power-query-m-primer-part5-paradigm

Stéphane

 

View solution in original post

1 REPLY 1
slorin
Super User
Super User

Hi,

May be, 

let
a = "123",
b = "456",
Choose = (chooseFirst as logical, first, second) =>
if chooseFirst then first else second
in
Choose(false, a, b)

https://bengribaudo.com/blog/2018/02/28/4391/power-query-m-primer-part5-paradigm

Stéphane

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors