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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch 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
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!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.