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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch 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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.

Top Kudoed Authors