Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi All,
I am new to Power BI and DAX, wanting to achieve below mentioned 3rd column using DAX. Any help on this highly appreciated.
Date | Population | Daily Change |
01-01-2020 | 100 | 100 (since no previous date) |
02-01-2020 | 300 | 200 (300 - 100) |
03-01-2020 | 500 | 200 (500 - 300) |
Any help woul dbe highly appreciated. Thanks!
@ashah2020 , This will give change . you can create text column on that
new colum =
var _date = maxx( filter(Table,[date] <earlier([date])),[Date])
return
[Population] - maxx( filter(Table,[date] = _date)),[Population])
// prefer this if you continuous date
new colum =
[Population] - maxx( filter(Table,[date] = earlier([date])-1),[Population])
Hi @ashah2020 ,
Incase you want a measure
Change =
VAR _prevdate =
MAXX (
FILTER (
ALL ( 'Table' ),
'Table'[Date]
< MAX ( 'Table'[Date] )
),
'Table'[Date]
)
RETURN
IF (
_prevdate
= BLANK (),
0,
SUM ( 'Table'[Population] )
- CALCULATE (
SUM ( 'Table'[Population] ),
FILTER (
ALL ( 'Table' ),
'Table'[Date] = _prevdate
)
)
)
Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)
User | Count |
---|---|
16 | |
13 | |
12 | |
11 | |
11 |
User | Count |
---|---|
19 | |
14 | |
14 | |
11 | |
9 |