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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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