Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Torudd-55
Frequent Visitor

DAX formula

Hi!

 

I would like to get help with a, hopefully, easy question. How can i write a DAX command/formula to only select all of the orders in a table that contains an item with a specific vendor. For example, if i only want the orders in the table below containing the vendor "milk", how do i write the DAX formula so it doesn't just show the orders and the specific item with the vendor "milk"? I want the result to show all the orders containing an article with the vendor but still vizualises all of the items whitin the order. In the table below, the order "2" should be removed but the rest vizualised as it is.

 

Thanks in advance!

 

order.noitem.novendor
123water
 24milk
 25milk
 26water
223water
 26water
328tea
 29soda
 30sparkling water
 24milk
424milk
 29soda
525milk
 26water
629soda
 25milk
 24milk
1 REPLY 1
lc_finance
Solution Sage
Solution Sage

Hi @Torudd-55 ,

 

 

Here is how to prepare a calculated column to use for this filter.

You can download the Power BI file for my proposed solution from here.

 

Here are the steps:

1) I completely filled the order no so that each row has an order number

2) I added a calculated column for the orders with milk (Modeling -> New column)

Below is the DAX formula:

Orders with milk = 
CALCULATE(CONTAINS('Orders',[vendor],"milk"),
ALLEXCEPT('Orders','Orders'[order.no]))

Here is a screenshot of the new column, which you can use to filter out the table:

Orders with milk.png

 

I hope this helps you. Do not hesitate if you have more questions.

 

LC

Interested in Power BI and DAX templates? Check out my blog at www.finance-bi.com

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors