Forum Discussion

PetarRog's avatar
PetarRog
New Member
4 years ago
Solved

Need to transfer sum case when from SQL to DAX

Hello, 

 

Can you help me to transfer the following statement to power BI from SQL (Google data studio) 

 

Sum(case when CONTAINS_TEXT(Status,"Done") then 1 else 0 end)/sum (case when Status is not null then 1 else 0 end)

 

Both columns are strings not numbers. 

 

Thanks in advance! 

 

 

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi i belive this could be what you are looking for;

     

     

     

    Dax =
    DIVIDE (
        CALCULATE ( COUNTROWS ( 'Table' )CONTAINSSTRING ( 'Table'[status], "Done" ) ),
        CALCULATE ( COUNTROWS ( 'Table' ), 'Table'[status] <> BLANK () ),
        BLANK ()
    )

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi i belive this could be what you are looking for;

     

     

     

    Dax =
    DIVIDE (
        CALCULATE ( COUNTROWS ( 'Table' )CONTAINSSTRING ( 'Table'[status], "Done" ) ),
        CALCULATE ( COUNTROWS ( 'Table' ), 'Table'[status] <> BLANK () ),
        BLANK ()
    )