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
jaltoft
Resolver I
Resolver I

Dax to Powerquery

Power query from dax?

 

Hello can anyone help me optimize this query from dax into Powerquery?

 

IF([CONSENT]=="CSC", IF([OUTCOME_Msh_FLAG]=="Y",IF([Msh_DEC_DTTM]=BLANK(),-1,[Msh_Timeliness]),[Timeliness]),[Timeliness])
 
 
2 ACCEPTED SOLUTIONS
d_gosbell
Super User
Super User

Assuming these are all column references it would be something like the following

 

if [CONSENT] ="CSC" then

   if [OUTCOME_Msh_FLAG] ="Y" then
       if [Msh_DEC_DTTM] = null then -1
       else [Msh_Timeliness]
   else [Timeliness]
else [Timeliness]

View solution in original post

v-yetao1-msft
Community Support
Community Support

Hi @jaltoft 

In Power query , the formula for IF function is like this:

if "if-condition" then "true-expression" else "false-expression"

So for your Dax ,we can convert it like this:

if [CONSENT]="CSC" then if [OUTCOME_Msh_FLAG]="Y" then if [Msh_DEC_DTTM]=null then -1 else [Msh_Timeliness] else [Timeliness] else [Timeliness]

Ailsamsft_0-1624344515018.png

And the result is the same as DAX

Ailsamsft_1-1624344515020.png

Best Regards

Community Support Team _ Ailsa Tao

 

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
v-yetao1-msft
Community Support
Community Support

Hi @jaltoft 

In Power query , the formula for IF function is like this:

if "if-condition" then "true-expression" else "false-expression"

So for your Dax ,we can convert it like this:

if [CONSENT]="CSC" then if [OUTCOME_Msh_FLAG]="Y" then if [Msh_DEC_DTTM]=null then -1 else [Msh_Timeliness] else [Timeliness] else [Timeliness]

Ailsamsft_0-1624344515018.png

And the result is the same as DAX

Ailsamsft_1-1624344515020.png

Best Regards

Community Support Team _ Ailsa Tao

 

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

d_gosbell
Super User
Super User

Assuming these are all column references it would be something like the following

 

if [CONSENT] ="CSC" then

   if [OUTCOME_Msh_FLAG] ="Y" then
       if [Msh_DEC_DTTM] = null then -1
       else [Msh_Timeliness]
   else [Timeliness]
else [Timeliness]

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.