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.
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
// Index each month against the first month shown (=100)
Sum(Sales) / Top(Sum(Sales)) * 100Power BI equivalent
Visual calculation
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)
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 ) * 100Gotchas 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. AddREMOVEFILTERS ( 'Date'[Month Label] ), naming your label column, inside theCALCULATE. - Visual calculations can't be reused in other visuals and are excluded from data exports. See the limitations in RangeSum.
Official documentation
- Top - chart function (Qlik Help)
- First - chart function (Qlik Help)
- FIRST function (DAX) (Microsoft Learn)
- INDEX function (DAX) (Microsoft Learn)
- Using visual calculations (Microsoft Learn)
Related pages
Above(Sum(Sales))
Above, Below, Before and After
Above() reads the value from the previous row of the chart. Power BI offers three replacements: the OFFSET window function, the PREVIOUS visual calculation, and calendar-aware time intelligence. Each behaves differently when periods are missing.
Partial / different approach
RangeSum(Above(Sum(Sales), 0, RowNo()))
Running totals with RangeSum(Above(...))
The Qlik running-total idiom RangeSum(Above(Sum(Sales), 0, RowNo())) maps to a cumulative DAX measure, a WINDOW function, or the RUNNINGSUM visual calculation.
Partial / different approach
Rank(Sum(Sales))
Rank
Qlik's Rank() ranks rows within the current column segment and has its own tie modes and a text format ("3 - 4"). In DAX, use RANKX or the newer RANK window function. Pick the ties option deliberately.
Partial / different approach
Column(1) / Column(2)
Column(n) and expression labels
In a Qlik table, Column(n) or an expression label reuses the result of another measure column. In Power BI you reference the measure by name, which works anywhere. Visual calculations let you refer to the fields on the visual, which is the closest thing to "the column next to me".
Partial / different approach
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.