Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Slicer AND Logic Within Same Product

Needing some help figuring out how to set up slicer logic so that a user can bundle multiple attributes together and see what other attributes are also associated with those UPCs that have ALL select...
  • AlexisOlson's avatar
    AlexisOlson
    4 years ago

    This is tricky. You don't want the attribute slicer filtering the attribute list directly but indirectly through the UPC... not simple.

     

    In order to do this, you have to have a new table since the existing slicer column can't be used in the table.

     

    I created DimAttributes table of unique attributes simply defined as

    DimAttributes = VALUES ( Attributes[ATTRIBUTE] )

     and set up the relationships like this:

    Then I defined a new measure and put it on a table with DimAttribute[ATTRIBUTE].

    Attribute Sales = 
    VAR ValidUPCs =
        FILTER (
            VALUES ( UPC[UPC] ),
            CALCULATE ( [HasAllAttributes], ALL ( DimAttributes ) ) = 1
        )
    RETURN
        CALCULATE (
            SUM ( Dollars[Dollar Sales] ),
            REMOVEFILTERS ( Attributes[ATTRIBUTE] ),
            CROSSFILTER ( Attributes[UPC], UPC[UPC], BOTH ),
            KEEPFILTERS ( UPC[UPC] IN ValidUPCs )
        )

    I don't have the energy to explain all of the subtleties involved in the measure above at the moment but I think it at least works.