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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
jmuth
Frequent Visitor

Calculate latest value in timeline - but total is still wrong

Hello everyone

I am fairly new to Power BI and DAX in particular is still causing me a lot of problems.

 

I want to create a KPI tile with a time series (last 12 months) and the current/last value in the header. I use a line chart for this.

jmuth_0-1707686581042.png jmuth_1-1707686609682.png

 

If I display the value directly in the line chart, everything is fine. But in the header the same logic it is not working.

 

In a table, however, the correct value is displayed in the time series, but the unfiltered total is still calculated under "Total". This somehow seems to be the cause, but I am totally lost solving the problem:

jmuth_2-1707686904271.png

GTK per Monat Σ Gesamt Ende Label = 

VAR MaxDate =
    CALCULATE ( MAX ( '02 Kalender'[Datum] ), ALLSELECTED () )
RETURN
    IF ( MAX ( '02 Kalender'[Datum] ) = MaxDate, [GTK per Monat Σ Gesamt] )

 

KPI HR GTK Header = 

VAR MaxDate =
    CALCULATE ( MAX ( '02 Kalender'[Datum] ), ALLSELECTED () )
RETURN
    //CONVERT(MaxDate, STRING)
CONVERT(IF ( MAX ( '02 Kalender'[Datum] ) = MaxDate, [GTK per Monat Σ Gesamt] ), STRING)

I would be infinitely grateful if anyone has any advice.

 

Best regards

Jennifer

1 ACCEPTED SOLUTION

Hi @talespin ,

 

thank you for your reply. I didn't work out for my use case... I don't get it...

 

Nevertheless, I found a workaround - at least for my specific use case:

KPI HR GTK Header = 

CONVERT(LASTNONBLANKVALUE('02 Kalender (Betrachtungszeitraum)'[Datum], [GTK per Monat Σ Gesamt]), STRING)

 

Kind regards!

View solution in original post

2 REPLIES 2
talespin
Solution Sage
Solution Sage

hi @jmuth 

 

I used a Calendar table and TestTable with one to many relationship.

 

Latest Value =
VAR _MaxDt = CALCULATE( MAX(TestTbl5[Dt]), REMOVEFILTERS(TestTbl5) )
VAR _Val = CALCULATE( VALUES(TestTbl5[Value]), REMOVEFILTERS(TestTbl5), 'CALENDAR'[Date] = _MaxDt)

RETURN IF( ISBLANK(MAX(TestTbl5[Dt])), BLANK(),_Val)
 

talespin_0-1707699892749.png

talespin_1-1707699988926.png

 

 

Hi @talespin ,

 

thank you for your reply. I didn't work out for my use case... I don't get it...

 

Nevertheless, I found a workaround - at least for my specific use case:

KPI HR GTK Header = 

CONVERT(LASTNONBLANKVALUE('02 Kalender (Betrachtungszeitraum)'[Datum], [GTK per Monat Σ Gesamt]), STRING)

 

Kind regards!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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