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
nmehra2205
New Member

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
1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hi, @nmehra2205 

 

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

c1.png

 

You may create a measure as follows.

 

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

 

 

Result:

c2.png

 

Then I add a new row.

c4.png

Here is the result.

c3.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.

 

View solution in original post

7 REPLIES 7
v-alq-msft
Community Support
Community 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

v-alq-msft
Community Support
Community Support

Hi, @nmehra2205 

 

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

c1.png

 

You may create a measure as follows.

 

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

 

 

Result:

c2.png

 

Then I add a new row.

c4.png

Here is the result.

c3.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.

 
amitchandak
Super User
Super User

@nmehra2205 ,

While solutions from @Greg_Deckler  and @Ashish_Mathur  should work for you. Also, try if lastnonblankvalue can fit in you case

https://docs.microsoft.com/en-us/dax/lastnonblankvalue-function-dax

lastnonblankvalue(Table[date],sum(table[Steps]))

This came in the latest release only. So you should be on the latest version.

 

Ashish_Mathur
Super User
Super User

Hi,

Try these measures

Steps taken = SUM(Data[Steps])

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

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Greg_Deckler
Super User
Super User

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.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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)

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.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.