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

Get the First value and Last value Only

I have a table with a production line information
like
Model
Start Date
End Date
and others

I want to show in a Column Visual only the first data when the model was registered and the last date that was registered
Similar to this 

EC3_0-1611354609096.png

Each color represents a Car Model 
I dont need to display the middle values , just the first and last one

It is possible?

4 REPLIES 4
v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

Table:

h1.png

 

You may create a measure as below.

Visual Control = 
var mindate = 
CALCULATE(
    MIN('Table'[Date]),
    FILTER(
        ALLEXCEPT('Table','Table'[Model]),
        [IsReistered]="Yes"
    )
)
var maxdate = 
CALCULATE(
    MAX('Table'[Date]),
    FILTER(
        ALLEXCEPT('Table','Table'[Model]),
        [IsReistered]="Yes"
    )
)
return
IF(
    MAX('Table'[IsReistered])="Yes"&&(MAX('Table'[Date])=mindate||MAX('Table'[Date])=maxdate),
    1,0
)

 

Then you need to put the measure in the visual level filter to filter the result.

h2.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

It works, but I only get the last date 

In your visual yo have the first date when the model A entered and the last dat whne the model change occurrs 

and I only get the latest date of each model

what could be possible wrong?

 

Hi, @Anonymous 

 

Could you please show us some sample data and expected results with OneDrive for business? Do mask sensitive data before uploading. Thanks.

 

Best Regards

Allan

lbendlin
Super User
Super User

Have you looked at MIN/MAX, FIRSTDATE/LASTDATE, FIRSTNONBLANK/LASTNONBLANK ?

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.