Sum(Sales) / Top(Sum(Sales))

Top, Bottom, First and Last in charts in Power BI

Top() and Bottom() return an expression's value on the first or last row of the current column segment, typically to index against a base period. Visual calculations have FIRST and LAST, which do the same over the rows of the visual. In model measures, use INDEX(1) or INDEX(-1) over ALLSELECTED.

Partial / different approach Visual calculations DAX

Short answer: For a visual calculation, use [Sum of Sales] / FIRST([Sum of Sales]). For a model measure, use DIVIDE([Sales], CALCULATE([Sales], INDEX(1, ALLSELECTED('Date'[Year Month]), ORDERBY('Date'[Year Month])))). Order by a sortable key such as Year Month, not a month name, which sorts alphabetically.

What it does in Qlik

Top([TOTAL] expr [, offset [, count]]) evaluates the expression on the first row of the current column segment. Bottom uses the last row. First and Last do the same horizontally across pivot columns. They depend on the chart's sort order.

Qlik example

Qlik chart expression
// Index each month against the first month shown (=100)
Sum(Sales) / Top(Sum(Sales)) * 100

Power BI equivalent

Visual calculation

DAX
Index vs first = DIVIDE ( [Sum of Sales], FIRST ( [Sum of Sales] ) ) * 100
Share of last = DIVIDE ( [Sum of Sales], LAST ( [Sum of Sales] ) )

FIRST and LAST follow the visual's axis order. They don't reset by default. To restart per parent group the way a Qlik column segment does (all dimensions except the last), pass LOWESTPARENT as the optional reset argument. HIGHESTPARENT restarts only at the top-level group.

Model measure (works in any visual)

DAX
Index vs first month =
VAR monthsWithSales =
    FILTER ( ALLSELECTED ( 'Date'[Year Month] ), NOT ISBLANK ( [Sales] ) )   -- Qlik hides empty rows
VAR firstMonthSales =
    CALCULATE (
        [Sales],
        INDEX ( 1, monthsWithSales, ORDERBY ( 'Date'[Year Month], ASC ) )
    )
RETURN DIVIDE ( [Sales], firstMonthSales ) * 100

Gotchas and behaviour differences

  • Qlik's Top depends on how the chart is sorted at the moment. INDEX uses the ORDERBY you write, so sorting the visual by sales does not change the base month. That's usually what you want.
  • The measure assumes 'Date'[Year Month] is the column on the axis. If the axis shows a label column instead (for example a "Jan 2026" text column sorted by Year Month), the label's filter stays on the row and the base month comes back blank. Add REMOVEFILTERS ( 'Date'[Month Label] ), naming your label column, inside the CALCULATE.
  • Visual calculations can't be reused in other visuals and are excluded from data exports. See the limitations in RangeSum.

Official documentation

Related pages

Spotted an error or a better pattern? QlikToDax is maintained by a working BI consultant; corrections are welcome via the About page. Last reviewed 2026-10-25.