user1638340
user1638340

Reputation: 11

Power BI calculate increase based on next & previous values

I'm new to Power BI and have an assignment to hand in for school. Awaiting for 365 admin to grant access to power BI community I'm hoping someone can help me explain the following:

In this basic Table called Population, there is data over 10 years for each country and their population. I would like to add a column and with DAX formula calculate the increase relative to last year.

So I would think the basic idea is something like

Increase = CALCULATE(SUMX(population, Filter(Population, Population[Year] = Population[year] + 1) - Population[Population))

But I'm not finding the right formula.

Any help would be much appreciated.

Upvotes: 0

Views: 1359

Answers (1)

j.p
j.p

Reputation: 106

calculated_column:

  1. NewColumn_calculate = population[Population]-CALCULATE(SUM(population[Population]), FILTER(population, EARLIER(population[Country]) = population[Country] && EARLIER(population[Year]) = population[Year] + 1))

  2. NewColumn_sumx = population[Population]-SUMX(FILTER(population, EARLIER(population[Country]) = population[Country] && EARLIER(population[Year]) = population[Year] + 1), population[Population])

measure:

Measure = SUM(population[Population]) - SUMX(FILTER(all(population), population[Country] = MAX(population[Country]) && population[Year] = MAX(population[Year]) - 1), population[Population])

Upvotes: 1

Related Questions