Forum Discussion

jaltoft's avatar
jaltoft
Resolver I
5 years ago
Solved

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])
 
 
  • 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]

  • Anonymous's avatar
    Anonymous
    5 years ago

    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]

    And the result is the same as DAX

    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.

2 Replies

  • 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]

  • Anonymous's avatar
    Anonymous
    Not applicable

    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]

    And the result is the same as DAX

    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.