Forum Discussion

B_Smith's avatar
B_Smith
Frequent Visitor
8 years ago
Solved

DAX Comparison Measure

Hello, sorry if there are multiples, was not appearing in the topic list!   I'm trying to get a Dax calculation right for a measure and having some problems. I know it's some combination of allsele...
  • Anonymous's avatar
    Anonymous
    8 years ago

    Try this:

    [SubCategory Sales] =
    VAR CurrentSubCategory =
        VALUES ( ProductTable[Product Subcategory] )
    RETURN
        CALCULATE (
            SUM ( Sales[Sales] ),
            ALL ( ProductTable[Product Name] ),
            ProductTable[Product Subcategory] = CurrentSubcategory
        )

    and this:

    [Category Sales] =
    VAR CurrentCategory =
        VALUES ( ProductTable[Product Category] )
    RETURN
        CALCULATE (
            SUM ( Sales[Sales] ),
            ALL ( ProductTable[Product Name] ),
            ProductTable[Product Category] = CurrentCategory
        )