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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Need to grab the first value of a column sorted by date

Hey everone, 

 

I have a requirement where I need to take the first value of the count column (not minimum or sum).

For e.g. I have dummy data below where the slicer is from 1/1/2020. I need to be able to take the first "From_Count" on the row when sorted by that specific date.

 

In this scenario the calculation would take the count 203 as that is the first value of the table sorted by the date.

 

Can anyone help?

 

I tried creating

CALCULATE(sum(CRCT_METER_CNT[From_Count]), FILTER(CV_BW_DIM_DATE,CV_BW_DIM_DATE[DATE] = [FROM_DATE_FROM_SLICER]))

 

however the measure is giving me a value of 2466 and not 203.

 

Screenshot (8).png

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous 

Not sure of the calculation [FROM_DATE_FROM_SLICER]. You can use min or max or slicer date and create a formula like

 

 

Measure =
var _max = maxx(Date,Date[Date])// [FROM_DATE_FROM_SLICER], use min or mex

CALCULATE(sum(CRCT_METER_CNT[From_Count]), FILTER(CV_BW_DIM_DATE,CV_BW_DIM_DATE[DATE] =_max ))

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@Anonymous 

Not sure of the calculation [FROM_DATE_FROM_SLICER]. You can use min or max or slicer date and create a formula like

 

 

Measure =
var _max = maxx(Date,Date[Date])// [FROM_DATE_FROM_SLICER], use min or mex

CALCULATE(sum(CRCT_METER_CNT[From_Count]), FILTER(CV_BW_DIM_DATE,CV_BW_DIM_DATE[DATE] =_max ))

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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