Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

How to Filter data and get record in DAX

I want to filter Worker table in DAX and get data like

Select * from Worker w
where w.Name <> "Once Off"

  • Anonymous's avatar
    Anonymous
    4 years ago
    Issue resolved.
    CALCULATE(
    SUM(InvoiceLines[Tons]),
    FILTER(InvoiceLines, InvoiceLines[ITEMID] = InventoryStock[ITEMID]),
    Filter(Worker, Worker[WORKERNAME] <> "Once Off")
    )

6 Replies

  • smpa01's avatar
    smpa01
    Icon for Community Champion rankCommunity Champion

    Anonymous  equivalent DAX query would be

    //in SSAS
    EVALUATE 
    FILTER(Worker, Worker[Name]<>"Once Off")
    //in PBI
    Table = FILTER(Worker, Worker[Name]<>"Once Off")
    • Anonymous's avatar
      Anonymous
      Not applicable

      No any trick to filter data in new column/new measure?

      • smpa01's avatar
        smpa01
        Icon for Community Champion rankCommunity Champion

        Yes there is. Anonymous  but how does your data look like? Provide a sample and what is the end goal?

  • v-yalanwu-msft's avatar
    v-yalanwu-msft
    Icon for Community Support rankCommunity Support

    Hi, Anonymous ;

    If you only want to filter columns in visual or data view, you can directly filter like below:

     

    If you want to use dax, you could create a measure.

    flag = IF(MAX('Table'[Name])="Once Off",0,1)

    then apply it into filter.

    Best Regards,
    Community Support Team_ Yalan Wu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • Anonymous's avatar
      Anonymous
      Not applicable
      Issue resolved.
      CALCULATE(
      SUM(InvoiceLines[Tons]),
      FILTER(InvoiceLines, InvoiceLines[ITEMID] = InventoryStock[ITEMID]),
      Filter(Worker, Worker[WORKERNAME] <> "Once Off")
      )