Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
Good morning,
Can anyone tell me how to replicate this seasonality graph in Power BI?
On the "X" axis I have the months and as a measure I have:
I could only do it in Python, but because the base is quite large, the graph takes an average of 5 to 10 seconds to appear.
If you have a solution via Power BI graphics, it would be much better.
I'll share here the code I used to do it in Python (if maybe there's something that can be done to optimize the code)
Thanks in advance for your help
Code in Python:
import matplotlib.pyplot as plt
import numpy as np
from scipy.interpolate import make_interp_spline
plt.rcParams["figure.figsize"]=(30,10)
font = {
'family' : 'normal', # dict com dados de fontes
'weight' : 'bold',
'size' : 15
}
matplotlib.rc('font', **font)
plt.style.use("bmh") #("seaborn") ("ggplot") ("Solarize_Light2") ("fivethirtyeight") ("dark_background")
ax = plt.gca()
dataset.plot(kind='line', x='MONTH_NAME', y='AVERAGE_5_YEARS', color='k', ax=ax, linestyle='dotted', label='Media', linewidth=3.5)
dataset.plot(kind='line', x='MONTH_NAME', y='VALUE_LAST_YEAR', color='red', ax=ax, linestyle='dotted', label='Ano Anterior', linewidth=3.5)
dataset.plot(kind='line', x='MONTH_NAME', y='VALUE_YEAR_TODAY', color='mediumblue', ax=ax, marker='o', label='Ano Atual', linewidth=3.5)
dataset.plot(kind='line', x='MONTH_NAME', y='MAX_VALUE_5_YEARS', color='grey', ax=ax, label='Max')
dataset.plot(kind='line', x='MONTH_NAME', y='MIN_VALUE_5_YEARS', color='grey', ax=ax, label='Min')
plt.legend(prop={'size':10}, loc=2, facecolor='gray')
x = dataset['MONTH_NAME']
y = dataset['MAX_VALUE_5_YEARS']
y1 = dataset['MIN_VALUE_5_YEARS']
plt.fill_between(x, y, y1, facecolor='grey') #hatch='\\\\',
ax.axes.xaxis.set_visible(True)
ax.axes.yaxis.set_visible(True)
ax.tick_params(axis='x', colors='darkgray')
ax.tick_params(axis='y', colors='darkgray')
plt.xlabel("", labelpad=7)
plt.xlim(left=0)
plt.grid(color = 'darkgray', linestyle = '--', linewidth = 0.5)
plt.savefig("grafico-background-05.png", dpi=150, transparent='True')
plt.show()
Solved! Go to Solution.
I solved it by placing one graphic on top of the other
first an area chart with maximum and minimum, and then another chart with the other measures
I solved it by placing one graphic on top of the other
first an area chart with maximum and minimum, and then another chart with the other measures
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Ask questions in Eventhouse and KQL, Eventstream, and Reflex.
User | Count |
---|---|
86 | |
84 | |
66 | |
62 | |
59 |
User | Count |
---|---|
197 | |
116 | |
107 | |
77 | |
70 |