Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
| Month | A | B | C | D | E |
| January | 58 | 123 | 123 | 234 | 23 |
| February | 64 | 234 | 233 | 44 | 34 |
| March | 34 | 455 | 333 | 56 | 56 |
| April | 55 | 333 | 456 | 77 | 78 |
| Change |
|
Hi,
Let's say I have table like this. I am trying to add row at the en 'Change' which will show me precentage change between last 2 months, so basicaly formula (April-March)/March*100 how can I add this? Note that every month data will be refreshed and new row with new month will be added so I always want only change between current month and previous month % comparison.
Solved! Go to Solution.
To play it safe (incase you have different years) it is better to have a YearMonth Calculated Column.
YearMonth = FORMAT ( 'Table'[Date], "YYMM" )
then the measure for A for example would be
A Measure =
VAR Last2Months =
TOPN ( 2, VALUES ( 'Table'[YearMonth] ) )
VAR LastMonth =
MAXX ( Last2Months, 'Table'[YearMonth] )
VAR PenultimateMonth =
MINX ( Last2Months, 'Table'[YearMonth] )
VAR LastValue =
CALCULATE ( SUM ( 'Table'[A] ), 'Table'[YearMonth] = LastMonth )
VAR PenultimateValue =
CALCULATE ( SUM ( 'Table'[A] ), 'Table'[YearMonth] = PenultimateMonth )
RETURN
IF (
HASONEVALUE ( 'Table'[YearMonth] ),
SUM ( 'Table'[A] ),
FORMAT ( DIVIDE ( LastValue - PenultimateValue, PenultimateValue ), "Percent" )
)
how does the source data look like? Are you utilizing a date table?
Each month I run Python script wchich adding data for current month, its basicly table with over 30k rows each month and each month that 3ok rows are added to previous file, so its one big file with 100k+ rows and aroung 40 columns. This visualisation is based on column Month and the columns A,B,C,D etc are columns for specific platforms. So at the end of May Python script will generate new data and row for May will show up and I would like to have always additional row on the end which calculate precetage of change between current month and previous month. If not possible to have it at the bottom of the table I dont mind having additional table with comparison only
Count of number of users - as values
Platform type - as columns
date format cell (month) - as rows
To play it safe (incase you have different years) it is better to have a YearMonth Calculated Column.
YearMonth = FORMAT ( 'Table'[Date], "YYMM" )
then the measure for A for example would be
A Measure =
VAR Last2Months =
TOPN ( 2, VALUES ( 'Table'[YearMonth] ) )
VAR LastMonth =
MAXX ( Last2Months, 'Table'[YearMonth] )
VAR PenultimateMonth =
MINX ( Last2Months, 'Table'[YearMonth] )
VAR LastValue =
CALCULATE ( SUM ( 'Table'[A] ), 'Table'[YearMonth] = LastMonth )
VAR PenultimateValue =
CALCULATE ( SUM ( 'Table'[A] ), 'Table'[YearMonth] = PenultimateMonth )
RETURN
IF (
HASONEVALUE ( 'Table'[YearMonth] ),
SUM ( 'Table'[A] ),
FORMAT ( DIVIDE ( LastValue - PenultimateValue, PenultimateValue ), "Percent" )
)
Thank you, Overal it works but it using data from first 2 months instead of last 2 months, I know there is no BOTTOMN eqivalent to TOPN, do you have any idea how to solve this. I am new to PowerBi so still learning
Actually I found solution for this, Thank you for help!
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 7 | |
| 6 | |
| 4 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 25 | |
| 17 | |
| 9 | |
| 8 | |
| 7 |