Forum Discussion

glaucolrc's avatar
glaucolrc
New Member
5 years ago

Translating SQL Queries to DAX Queries

Sirs,

I'm having trouble converting this sql query to dax.

SELECT SUM(VALOR)
       FROM TB_Lancamentos
       WHERE TipoLancamento = 'RPIU'
           AND NOT EXISTS ( SELECT ID_Lancamento
                                             FROM TB_Lancamentos
                                             WHERE TipoLancamento = 'ARPIU'
                                                 AND ID_Lancamento_Pai NOT IN ( SELECT ID_Lancamento
                                                                                                              FROM TB_Lancamentos
                                                                                                               WHERE TipoLancamento = 'RPIU'
                                                                                                        )
                                         );

Can you help me?
Thanks.

 

1 Reply

  • Instead of trying to convert apples to oranges (also known as "fighting the API") you will want to write down the business question you are planning to answer, and then you can construct your Power Query or DAX code step by step to solve that question.

     

    Please provide sample data in usable format (not as a picture) and show the expected outcome.