Forum Discussion

JQuon's avatar
JQuon
Icon for Helper I rankHelper I
7 years ago
Solved

Use WHERE condition in DAX with Union and Selectcolumns?

I've created a calculated table that takes information from 5 different tables and consolidates it into 3 appended columns (Category, Name, Complete Date) on a single table.  The calculated table was created using Filter, Union, and selectcolumns.  The filter returns all items that are  not BLANK in the "Completed Date" column.

 

Is there a way to use a where as or add multiple filters so I can return everything that is not BLANK and greater than the year January 2015?

 

 

Perforamance = filter(
     Union(
     Selectcolumns('Estimates',"Category","Estimator", "Name",'Estimates'[Estimator],"Completed Date",'Estimates'[Approval_Date]), [Completed Date]<>Blank())

 

  • JQuon's avatar
    JQuon
    7 years ago

    The outcome in my original formula is working and I do not receive an error message. The entire formula is about 20 lines and in my example in the original post, I only included the first string of the union, which I understand may cause confusion.

     

    Over the weekend I found a solution through additional research on the web and using || for more than one conditions appears to work.  I'm not sure why && doesn't work but || does.  Thanks for looking into this.

5 Replies

  • v-jiascu-msft's avatar
    v-jiascu-msft
    Icon for Microsoft Employee rankMicrosoft Employee

    Hi JQuon,

     

    It seems your formula won't work. But you only need to add more conditions in the filter like below. 

     

    , [Completed Date]<>Blank() && year([Completed Date]) >=2015)

    If you'd like more detailed formula, please provide a sample.

     

     

     

    Best Regards,
    Dale

    • JQuon's avatar
      JQuon
      Icon for Helper I rankHelper I

      I'm still searching for the proper solution.  Unfortunatenly, the && doesn't work with the rest of my string in my formula.  For now, I'm only able to filter on one condition listed in my original post.

       

      Thanks

      • v-jiascu-msft's avatar
        v-jiascu-msft
        Icon for Microsoft Employee rankMicrosoft Employee

        Hi JQuon,

         

        Is there an error? Or the outcome isn't correct? 

        If the formula is complete, the UNION isn't correct there. Please refer to the snapshot below. 

        Can you share a sample if you still have issues?

        Use-WHERE-condition-in-DAX-with-Union-and-Selectcolumns

         

        Best Regards,
        Dale