Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

SUMMARIZECOLUMNS (SQL to DAX)

Hello,   DATA: I have two columns CustomerID and SalesID.   GOAL: I made a table visual in the screenshot below displaying CustomerID and Max(SalesID) where SalesID is above -1. That means, the ...
  • amitchandak's avatar
    2 years ago

    Anonymous, Try a measure like

     

    Measure = Var _tab= SUMMARIZE('Table', 'Table'[CistomerId],"_1" ,Max('Table'[SalesID]))
    return COUNTROWS(SUMMARIZE(_tab,[_1]))

  • Anonymous's avatar
    Anonymous
    2 years ago

    Made a minor change to Amit's code to include the filter on SalesID

    Measure =
    VAR _tab =
        SUMMARIZE (
            'Table',
            'Table'[CistomerId],
            "_1", CALCULATE ( MAX ( 'Table'[SalesID] ), 'Table'[SalesID] > -1 )
        )
    RETURN
        COUNTROWS ( SUMMARIZE ( _tab, [_1] ) )