cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

Select the last day value dynamically

Hi guys

i am new to power bi i need to calculate the stock of the last day dynamically. For example i having stocks from january 2018 to November 2019. I want to calculate the last day stock value say last day of November 2019 and if i select September in the filter it must show the last day stock value for september. Please provide me a solution.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User IV
Super User IV

Re: Select the last day value dynamically

Hi,

You may download my solution PBI file from here.

Hope this helps.

Untitled.png


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

View solution in original post

4 REPLIES 4
Highlighted
Super User IV
Super User IV

Re: Select the last day value dynamically

Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

Second, MAX and MAXX are your friends in this case. So, if you select a month in some sort of Month slicer then I assume that all of the days for September will be in context so you could do something like:

 

Measure = 

  VAR __maxDate = MAXX('Some Table',[Date])

RETURN

  MAXX(FILTER('Some Table',[Date] = __maxDate),[Value])

 

This is all purely conjecture because I don't have any example source data.

 

 


---------------------------------------

Putting square pegs in round holes since 1972.

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Highlighted
Super User IV
Super User IV

Re: Select the last day value dynamically

Try

 

Last Day of month Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(sales,Sales[Sales Date]=ENDOFMONTH('Date'[date])))

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks.

My Recent Blog - https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
My Recent Blog -Week is not so Weak Connect on Linkedin

Proud to be a Super User!

Highlighted
Community Support
Community Support

Re: Select the last day value dynamically

Hi @sathish_kumar ,

 

Here I have created a sample for your reference. We can use a measure as below to work it out.

Measure = 
VAR LASTDAY =
    CALCULATE ( MAX ( 'Table'[date] ), ALLSELECTED ( 'Table' ) )
RETURN
    CALCULATE (
        SUM ( 'Table'[value] ),
        FILTER ( 'Table', 'Table'[date] = LASTDAY )
    )

 

Capture.PNG

 

For more details, please check the pbix as attached.

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
Highlighted
Super User IV
Super User IV

Re: Select the last day value dynamically

Hi,

You may download my solution PBI file from here.

Hope this helps.

Untitled.png


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

View solution in original post

Helpful resources

Announcements
May 2020 Community Highlights

May 2020 Community Highlights

It’s time for another PBI Community recap!

Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Galleries

Galleries

Looking for inspiration on how to present your data? Need instructional videos? Check out our Galleries!

Top Solution Authors