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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
luke050
Frequent Visitor

KPI compare values based on FIRSTDATE and LASTDATE

Hi,

 

I want to put KPI graph for quite simple thing

 

it will be based on two columns: Date and values for each date

it is important that one date can have several values

 

this is example

obraz.png

 

I want to compare the oldest date value with the most recent date value in this KPI in this case 752 vs 854

 

i have masures:

 

FirstDate = CALCULATE(MIN(sessions[profiles.followers]),FIRSTDATE(sessions[Date2]))
LastDate = CALCULATE(MAX(sessions[profiles.followers]),LASTDATE(sessions[Date2]))

 

 

 

 

but i dont know how i can compare it KPI.?

It returns 0 for FirstDate when using in KPI

 

obraz.png

 

obraz.png

 

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @luke050 

Use below codes for your FirstDate measure.

FirstDate = 
VAR _firstDate = MINX(ALL(sessions),sessions[Date2])
RETURN
CALCULATE(MIN(sessions[profiles.followers]),sessions[Date2]=_firstDate)

031601.jpg

 

In your original measure, FIRSTDATE(sessions[Date2]) performs context conversion and returns the first date in current context. Its current context is each date on the axis Date, so the FirstDate measure returns the minimum value on each date. In your example, there is only a value on the last date, so the maximum value and minimum value is the same and difference percentage is 0.

 

Regards,
Community Support Team _ Jing
If this post helps, please Accept it as the solution to help other members find it.

View solution in original post

1 REPLY 1
v-jingzhang
Community Support
Community Support

Hi @luke050 

Use below codes for your FirstDate measure.

FirstDate = 
VAR _firstDate = MINX(ALL(sessions),sessions[Date2])
RETURN
CALCULATE(MIN(sessions[profiles.followers]),sessions[Date2]=_firstDate)

031601.jpg

 

In your original measure, FIRSTDATE(sessions[Date2]) performs context conversion and returns the first date in current context. Its current context is each date on the axis Date, so the FirstDate measure returns the minimum value on each date. In your example, there is only a value on the last date, so the maximum value and minimum value is the same and difference percentage is 0.

 

Regards,
Community Support Team _ Jing
If this post helps, please Accept it as the solution to help other members find it.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors