The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
I may be thinking about this incorrectly however I have a simple column of data, and a second column that calculates the % change from the previous value in the first column.
Total | % Increase Over Time |
1.09 | 0% |
1.38 | 27% |
1.13 | -18% |
1.65 | 46% |
1.73 | 5% |
1.74 | 1% |
1.96 | 13% |
When I use a visual (e.g., a line chart) to graph the percentage change via the % Increase Over Time column, it properly graphs the values though I'm not sure that's what I really want. For example the % change between the 2nd and 3rd data points in the Total column is a decrease of 18%, however on the line graph this actually plots the value of -18%. I guess what I'm really after is to plot the values in the Total column, yet somehow show the actual percentage increase or decrease as the visual moves from one point to the next. Is this possible?
Thanks!
@jmscrx , You need to add an index column to know last row
Add Index -https://stackoverflow.com/questions/45715963/creating-an-index-column-for-power-bi
Then try a new column
new column =
var _last = maxx(filter(table, [Index] = earlier([Index])),[Total])
return
divide([[Total] -_last,_last,0)
@amitchandak - Was able to add the Index column easy enough though Power BI complains about the DAX query, specifically that it cannot find [[Total] in the DIVIDE statement. I tried replacing that both with the full table name and removing one of the leading [, which I thought may be redundant, though that was a guess on my part. Both of these attempts seem to solve the initial syntax error however the output column produces all 0 (zeros) instead of the desired percent change. The current DAX I have in place is below (table name here is 'Maturity' by the way). Additional thoughts?
@jmscrx , Sorry One mistake from my side, -1 missing
@amitchandak - Thanks again for the reply, this tweak to the formula works, however it produces the exact same numbers as the original Excel data that I was importing as a column (see original post comments where I had a column simply calculating the same percent change in Excel quite easily and just importing that into PowerBI).
Again, I could be missing something obvious here though my intention is to show the actual percentage increase or decrease on a visual (e.g. line graph) though if I plot the numbers/values as they exist even in your new column, this won't be indicative of the actual percentage of increase or decrease vs. plotting the actual value. For example in your new column (same as my original) the 3rd value shows a decrease of 18% from the previous, however I dont want -18 to be plotted as a value on my visual, I want to represent an 18% decrease from the previous. Now that I'm talking through it I suppose what really needs to happen here is now that I have the column of percentage increase or decrease based on the Total column, I now need to calculate the actual from the total column that represents that percentage of increase or decrease from the previous and those values are what is used in my visual.
Thanks!
@jmscrx , Try this as a new column
% Change = var _1 = MAXX(FILTER('Table (2)',[Index] =EARLIER([Index])-1),[Total]) return DIVIDE([Total]-_1, _1)
@amitchandak - Thanks again for your time spent here, though I feel I may not have properly articulated what I'm looking for. Essentiallly if you look at the below 1 or 2 visuals I want to be able to show the percentage change between each of the plotted data values, perhaps via a trend line or even some type of additional data labels.
Thanks!
User | Count |
---|---|
14 | |
11 | |
6 | |
6 | |
5 |
User | Count |
---|---|
28 | |
17 | |
11 | |
7 | |
5 |