Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
I have a table with price indexes for a list of SeriesID's dated for the end of every month. I want to add a column that will show me the previous month's index for each particular SeriesID in my table. Can anyone help?
Solved! Go to Solution.
Hi @jaybears130 ,
You can create a calculated column as below:
Previous Month's Value =
VAR _curmonthnum = 'Table'[Month Number]
VAR _curyear = 'Table'[Year]
VAR _year =
IF ( _curmonthnum = 1, _curyear - 1, _curyear )
VAR _monthnum =
IF ( _curmonthnum = 1, 12, _curmonthnum - 1 )
RETURN
CALCULATE (
MAX ( 'Table'[value] ),
FILTER (
ALL ( 'Table' ),
'Table'[seriesID] = EARLIER ( 'Table'[seriesID] )
&& 'Table'[Year] = _year
&& 'Table'[Month Number] = _monthnum
)
)
Best Regards
Hi @jaybears130 ,
You can create a calculated column as below:
Previous Month's Value =
VAR _curmonthnum = 'Table'[Month Number]
VAR _curyear = 'Table'[Year]
VAR _year =
IF ( _curmonthnum = 1, _curyear - 1, _curyear )
VAR _monthnum =
IF ( _curmonthnum = 1, 12, _curmonthnum - 1 )
RETURN
CALCULATE (
MAX ( 'Table'[value] ),
FILTER (
ALL ( 'Table' ),
'Table'[seriesID] = EARLIER ( 'Table'[seriesID] )
&& 'Table'[Year] = _year
&& 'Table'[Month Number] = _monthnum
)
)
Best Regards
@jaybears130 , I am not seeing index. I am assuming you need value
New column
Last Month Value =
var _1 = eomonth([Date] ,-1)
var _3 = [SeriesID]
return
sumx(filter(Table, eomonth([Date] ,0) = _1 && [SeriesID] =_3), [Value])
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
118 | |
79 | |
47 | |
45 | |
32 |
User | Count |
---|---|
172 | |
90 | |
66 | |
46 | |
45 |