DAX Codes KPI explanation and Visuals Explanation are as follows:
Dataset Description and Link are given here: https://colorstech.net/data-analytics/consumer-price-index-cpi-forecast-data-for-food-items-in-the-usa-for-practice/
Get Heatmap Visual in Power BI from here : https://appsource.microsoft.com/en-us/product/power-bi-visuals/
Get Power BI Course On Udemy : https://www.udemy.com/course/power-bi-tutorial-for-beginners-to-advanced/
KPI
Avg. CPI % Change (overall average inflation rate)
Highest Inflation Year (year with max CPI increase)
DAX code:
Max_CPI_Change = MAX(‘CPI_dataset'[forecast_percent_change])
Highest_Inflation_Year =
VAR MaxCPI = MAX(‘CPI_dataset'[forecast_percent_change])
RETURN
SELECTEDVALUE(‘CPI_dataset'[year_being_forecast],
CALCULATE(MAX(‘CPI_dataset'[year_being_forecast]),
‘CPI_dataset'[forecast_percent_change] = MaxCPI
)
)
Lowest Inflation Year (year with min CPI increase)
Lower_Inflation_Year =
VAR MinCPI = MIN(‘CPI_dataset'[forecast_percent_change])
RETURN
SELECTEDVALUE(‘CPI_dataset'[year_being_forecast],
CALCULATE(MIN(‘CPI_dataset'[year_being_forecast]),
‘CPI_dataset'[forecast_percent_change] = MinCPI
)
)
Most Volatile Food Category (category with highest price fluctuations)
Definition of Volatility:
Volatility can be measured using Standard Deviation of the forecast_percent_change for each food category.
A higher standard deviation means greater price fluctuations.
Category_Volatility =
CALCULATE(
STDEV.P(‘CPI_dataset'[forecast_percent_change]),
ALLEXCEPT(‘CPI_dataset’, ‘CPI_dataset'[consumer_price_index_item])
)
Explanation:
STDEV.P calculates the standard deviation of CPI % changes.
ALLEXCEPT ensures the calculation is grouped by consumer_price_index_item (food category).
Most_Volatile_Category =
VAR MaxVolatilityTable =
TOPN(1,
SUMMARIZE(
‘CPI_dataset’,
‘CPI_dataset'[consumer_price_index_item],
“Volatility”, STDEV.P(‘CPI_dataset'[forecast_percent_change])
),
[Volatility], DESC
)
RETURN
MAXX(MaxVolatilityTable, ‘CPI_dataset'[consumer_price_index_item])
Line Chart: Yearly CPI Trend (2002-2023)
X-axis: Year
Y-axis: CPI % Change
Lines: Different food categories
Insights: Shows long-term inflation patterns across food categories.
Clustered Bar Chart: Category-wise CPI % Change Comparison
X-axis: Food Categories
Y-axis: CPI % Change
Insights: Identifies which food items experienced the highest/lowest inflation.
Ribbon Chart (Best for Showing Ranges Between Forecasts)
Use When: You want to visualize forecast uncertainty with clear banding between Upper and Lower Bound.
How to Create:
X-axis: Time (Year/Month)
Y-axis: CPI Value
Legend: Attribute
Sorting: Ensure Midpoint is in the middle, with Upper and Lower bounds above/below.