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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
ay5h
Regular Visitor

Measure to sum the items associated to a selected set of items from another field in the same dim

I have a scenario where I have a slicer to select multiple products from a Product dimension. The products have various attributes for example Color or Product Line.

 

I need to create a sales total for all the Colors associated to the selected products. E.g. here I have used a slicer to pick two products and the associated colors are Blue and Silver:

 

ay5h_0-1656083808122.png

I need a measure that totals all Sales for Blue and Silver products, ignoring any filters on Product Name or Product Line.

 

I have tried the following:

Sales for Color = 
VAR _tbl = SUMMARIZE ( ALLSELECTED ( 'Product' ), 'Product'[Color] )
RETURN
    CALCULATE (
        [Sales],
        FILTER ( ALL ( 'Product' ), 'Product'[Color] IN _tbl )
    )

 

But this measure gets filtered if I additionally add a slicer on Product Line:

ay5h_1-1656084123892.png

 

How can I create the measure in a way that ignores any additional filters on the Product dimension?

 

I have attached a pbix with this example in further detail (1st page without an additional filter and a 2nd page showing the problem when filters are applied).

https://www.dropbox.com/s/0o3wgkvht3hnw5g/Question%20on%20DAX.pbix?dl=0

 

4 REPLIES 4
Anonymous
Not applicable

Thanks @Anonymous , I am looking at your suggestion and will let you know if I am able to adapt it to resolve this question.

amitchandak
Super User
Super User

@ay5h , Try like

 

CALCULATE ( [Sales],FILTER ( ALL ( 'Product' ), 'Product'[Color] = max('Product'[Color])))

 

or


CALCULATE ( [Sales],FILTER ( ALLSELECTED ( 'Product' ), 'Product'[Color] = max('Product'[Color])))

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Thanks @amitchandak but unfortunately this doesn't give me the result I was hoping for!

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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

Top Solution Authors