Forum Discussion
Power-BI
10 years agoNew Member
Smooth lines
Is there any way to smooth lines on a line chart? I'd like it to flow more like this one made in Excel, than the one below it made in PBI. Many thanks
- 10 years ago
hi. there is not a way to do this in powerbi that i am aware of.
I know that the smoothed line looks good but is it an accurate representation of the data?
cwert
3 years agoNew Member
So I managed to get a decent result for a smoothed linechart on a monthly basis:
LogisticSmoothing =
VAR GrowthRate = 0.5
VAR CurrentRowDate = MAX(SHARED_Date[Date])
VAR CurrentRowDatePM = PREVIOUSMONTH(SHARED_Date[Date])
VAR EndMonth = ENDOFMONTH(SHARED_Date[Date])
VAR Midpoint = DATE(YEAR(CurrentRowDate), MONTH(CurrentRowDate), 15)
VAR Sales = CALCULATE([Total_sales], ALL(SHARED_Date), MONTH(CurrentRowDate) = MONTH(SHARED_Date[Date]), YEAR(CurrentRowDate) = YEAR(SHARED_Date[Date]))
VAR SalesPM = CALCULATE([Total_sales], ALL(SHARED_Date), CurrentRowDatePM)
VAR SalesDiff = sales - SalesPM
VAR LogisticSmoothedValue =
CALCULATE (
DIVIDE (
1,
1 + EXP ( - GrowthRate * ( DATEDIFF(Midpoint, CurrentRowDate, DAY) ) )
)
) * SalesDiff
RETURN
LogisticSmoothedValue + SalesPM
This Formula calculates the Sales on a monthly basis but between each start and end of the month it calculates the change in a logistical curve so it smooths out the numbers betweeen each monts close. Be aware that this only works if you have "dates" on your x-axis. It may not represent your accurate data between months bit it looks just nice.