Forum Discussion

Dankang's avatar
Dankang
Regular Visitor
7 years ago
Solved

simple dax question

  Hi All,   Hope anyone can help me with this.   I am trying to get Total number of O&A Display for only the highest callfilevisit ID for Each outlet.    i.e outlet "1000245" will only n...
  • Stachu's avatar
    7 years ago

    try this code

    Measure =
    VAR OutletsVisits =
        GROUPBY (
            'Table',
            'Table'[OutletId],
            "Callfilevisit ID", MAXX ( CURRENTGROUP (), [Callfilevisit ID] )
        )
    RETURN
        CALCULATE (
            SUM ( 'Table'[Total O&A Displays] ),
            TREATAS ( OutletsVisits, 'Table'[OutletId], 'Table'[Callfilevisit ID] )
        )

    it gets the max callfilevisit per outlet and then calculates the sum of displays for these entries