Forum Discussion

nmehra2205's avatar
nmehra2205
New Member
6 years ago
Solved

Last Coulmn Value

hi all, i am new to power bi and looking for some help.

I have a table where i have entered data based on every date.

I want to show data only for my last row.

Lets Say i just want to show value of steps i have taken on 9 March 2020. For me it sums up value when i use card to display steps on dashboard

DateRunningStepsCalories Burn
8 March 202030007000200
9 March 202027006500180
  • Hi, nmehra2205 

     

    Based on your description, I created data to reproduce your scenario.

     

    You may create a measure as follows.

     

    LastestSteps = 
    LOOKUPVALUE(
        'Table'[Steps],
        'Table'[Date],
        CALCULATE(
            MAX('Table'[Date]),
            ALLSELECTED('Table')
        )
    )

     

     

    Result:

     

    Then I add a new row.

    Here is the result.

     

    Best Regards

    Allan

     

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

     

7 Replies

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

    So in generaly you do that like the following:

     

    Is Max Measure = 
      VAR __Date = MAX('Table'[Date])
      VAR __Max = MAXX(ALL('Table'),[Date])
    RETURN
      IF(__Date = __Max,TRUE(),FALSE())

     

    Then you can use this in your Filter pane to filter just for Is Max Measure equals True.

    • nmehra2205's avatar
      nmehra2205
      New Member

      Thank you for reply.But I am still not able to get the value of last coulmn.

      I need specefic value ie: number of steps today (no sum, mo median, no average)

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

        First the bad news. if you are going to use a measure, you have to use some form of aggregation.

         

        Now the good news, if you filter down to a single row and use any aggregation, you have the number.

         

        I made a minor adjustment to make the measure more filter friendly:

         

        Is Max Measure = 
          VAR __Date = MAX('Table'[Date])
          VAR __Max = MAXX(ALL('Table'),[Date])
        RETURN
          IF(__Date = __Max,1,0)

         

        I also wrote you this one that demonstrates how to extract a particular value:

         

        My Steps = 
            VAR __Table =
                ADDCOLUMNS(
                    'Table',
                    "__IsMaxMeasure",[Is Max Measure]
                )
        RETURN
            MAXX(
                FILTER(
                    __Table,
                    [__IsMaxMeasure] = 1
                ),
                [Steps]
            )

         

        And I attached the PBIX.

  • Hi,

    Try these measures

    Steps taken = SUM(Data[Steps])

    Steps taken on last date = CALCULATE([Steps taken],LASTDATE(Data[Date]))

    Hope this helps.

  • v-alq-msft's avatar
    v-alq-msft
    Icon for Community Support rankCommunity Support

    Hi, nmehra2205 

     

    Based on your description, I created data to reproduce your scenario.

     

    You may create a measure as follows.

     

    LastestSteps = 
    LOOKUPVALUE(
        'Table'[Steps],
        'Table'[Date],
        CALCULATE(
            MAX('Table'[Date]),
            ALLSELECTED('Table')
        )
    )

     

     

    Result:

     

    Then I add a new row.

    Here is the result.

     

    Best Regards

    Allan

     

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

     
  • v-alq-msft's avatar
    v-alq-msft
    Icon for Community Support rankCommunity Support

    Hi, nmehra2205 

     

    If you take the answer of someone, please mark it as the solution to help the other members who have same problems find it more quickly. If not, let me know and I'll try to help you further. Thanks.

     

    Best Regards

    Allan