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

Select only the latest value in gauge chart based on latest time

Hi all,

 

I have a set of values and I would like to select only the latest value based on the timestamp created.

The latest value can go as deep as 0.01 seconds of difference.

 

And also when I want to show the value in gauge, there is no option for me to show the latest value of generation only. Instead there are only options for sum, average and etc.

 

latestvalue.PNG

1 ACCEPTED SOLUTION

Hi @Anonymous ,

You can use following calculate column formula to mark last date for each id:

Is Last =
VAR currID = Table[ID]
VAR _lastdate =
    CALCULATE (
        MAX ( Table[CreateTimestamp] ),
        FILTER ( ALL ( Table ), [ID] = EARLIER ( Table[ID] ) )
    )
RETURN
    IF ( [CreateTimestamp] = _lastdate && [ID] = currID, "Y" )

For gauge chart, you can add a filter on visual level to display matched records.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

3 REPLIES 3
v-shex-msft
Community Support
Community Support

Hi @Anonymous ,

Please add index column to your table, then you can use current datetime and index fields to find out last records.

Measure =
VAR currDT =
    MAX ( Table[CreatedTimestamp] )
VAR _lastId =
    CALCULATE (
        MAX ( Table[Index] ),
        FILTER ( ALLSELECTED ( Table ), [CreatedTimestamp] = currDT )
    )
RETURN
    CALCULATE (
        MAX ( Table[Generation] ),
        FILTER (
            ALLSELECTED ( Table ),
            [CreatedTimestamp] = currDT
                && [Index] = _lastId
        )
    )

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Anonymous
Not applicable

I have a list of IDs and I want to show the latest value for every ID, how can I do it?

Appreciate your help, thanks. @v-shex-msft 

 

Capture.PNG

And I want to show every latest value in gauge chart as seen below:

gauge.PNG

Hi @Anonymous ,

You can use following calculate column formula to mark last date for each id:

Is Last =
VAR currID = Table[ID]
VAR _lastdate =
    CALCULATE (
        MAX ( Table[CreateTimestamp] ),
        FILTER ( ALL ( Table ), [ID] = EARLIER ( Table[ID] ) )
    )
RETURN
    IF ( [CreateTimestamp] = _lastdate && [ID] = currID, "Y" )

For gauge chart, you can add a filter on visual level to display matched records.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

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.