Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Help with getting the latest value in a table for a certain tag

Hi

 

I'm new to Power BI and I'm been maing a mock data set in excel. I have made a dashboard which can already show only certain tags based on the room or system, but I want to make a radial gauge which shows the current, or most recent value of whatever is selected but I am struggling to find a way to pull the latest value. Any help would be appriciated!

Thanks

 

This is a sample of the table

 

RoomTagTimeValue
Room 1Centrifuge 16/13/20 12:00 AM   605
Room 1Centrifuge 16/13/20 9:00 AM   917
Room 1Centrifuge 16/13/20 12:00 PM   667
Room 1Centrifuge 16/14/20 12:00 AM   671
Room 2BMS 47736/13/20 12:00 AM   888
Room 2BMS 47736/13/20 9:00 AM   803
Room 2BMS 47736/13/20 12:00 PM   541
Room 2BMS 47736/14/20 12:00 AM   733

 

  • Hi Anonymous 

     

    Try this 

    Measure = 
    VAR __lastDateTime =
        CALCULATE(
            MAX( 'Table'[International DateTime] ),
            ALL( 'Table' ),
            VALUES( 'Table'[Room] ), 
            VALUES( 'Table'[Tag] )
        )
    RETURN 
        CALCULATE(
            SUM( 'Table'[Value] ),
            KEEPFILTERS( 'Table'[International DateTime] = __lastDateTime )
        )

    it will result in 

     
     

     

    Best Regards,
    Mariusz

    If this post helps, then please consider Accepting it as the solution.

    Please feel free to connect with me.
    LinkedIn

     

2 Replies

  • Mariusz's avatar
    Mariusz
    Icon for Community Champion rankCommunity Champion

    Hi Anonymous 

     

    Try this 

    Measure = 
    VAR __lastDateTime =
        CALCULATE(
            MAX( 'Table'[International DateTime] ),
            ALL( 'Table' ),
            VALUES( 'Table'[Room] ), 
            VALUES( 'Table'[Tag] )
        )
    RETURN 
        CALCULATE(
            SUM( 'Table'[Value] ),
            KEEPFILTERS( 'Table'[International DateTime] = __lastDateTime )
        )

    it will result in 

     
     

     

    Best Regards,
    Mariusz

    If this post helps, then please consider Accepting it as the solution.

    Please feel free to connect with me.
    LinkedIn

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      That worked flawlessly. Thanks for the help Mariusz !