Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
betelgeutsen
Frequent Visitor

Show last label only on a line chart

Hello Power BI Community,


I have a question regarding creating a line chart using inflation data. The axis for the chart should contain both the quarter and year information. However, my data structure for quarters is unique, where Q1 represents only March, Q2 represents only June, Q3 represents only September, and Q4 represents only December. It is not the traditional quarterly structure like Q1: Jan - March, Q2: April - June, etc.


From this data, I want to create a line chart and display only the last value on the label. To achieve this, I have written a DAX formula named "Latest_Inflasi_Jatim_3" to show the last value only as written below:

Latest_Inflasi_Jatim_3 =
VAR Latest_Date = LASTDATE(PERIODE[Date])
VAR Latest_Quarter = QUARTER(Latest_Date)
VAR Latest_Year = YEAR(Latest_Date)
VAR Latest_Quarter_Start_Date = SWITCH(
Latest_Quarter,
1, DATE(Latest_Year, 3, 1),
2, DATE(Latest_Year, 6, 1),
3, DATE(Latest_Year, 9, 1),
4, DATE(Latest_Year, 12, 1) )
VAR Latest_Inf =
CALCULATE( data_inflasi_provinsi[inflasi_yoy_jatim],
FILTER( data_inflasi_provinsi, data_inflasi_provinsi[tanggal] >= Latest_Quarter_Start_Date && data_inflasi_provinsi[tanggal] <= Latest_Date ) )
RETURN Latest_Inf

The issue is that this formula currently displays all the values for each quarter, whereas I only want to show the latest quarter and year. For example, if my data ends in April 2023, I want to display only the data for Q1 2023 which means the data shows is the data in March 2023.

betelgeutsen_0-1690858297796.png

(the issue)

Any guidance on how to modify the DAX formula to achieve this would be greatly appreciated. Thank you in advance for your help!

0 REPLIES 0

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors
Top Kudoed Authors