cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Hamdan1234
Helper III
Helper III

Last date of month sales based on slicer selection

Hello,

I was looking for last dates for each month sales based on selection of single sliicer. I serached and found out a video linked and picture are attached below where on single selection it shows last 6 months of slicer month sales. 

https://www.sqlbi.com/articles/show-previous-6-months-of-data-from-single-slicer-selection/

ssddff.PNG

but I want only last date sales for each month instead of whole month. For example when the user selects '2021-11-20', we want to see the dates of '2021-10-30', '2021-09-29', '2021-08-30' etc ...

Is it possible?

Kindly help.

Thanks

1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi, @Hamdan1234 ;

You could create a another table then create a measure .

1.create a table as slicer, and don't create a relationship.

slicer = SUMMARIZE('Table',[Date],"year-month",FORMAT([Date],"mmmm yyyy"))

2.create a measure.

CumProduction =
CALCULATE (
    SUM ( 'Table'[Production] ),
    FILTER (
        ALLEXCEPT ( 'Table', 'Table'[Location] ),
        [Months Producing] <= MAX ( 'Table'[Months Producing] )
    )
)

The final output is shown below:

vyalanwumsft_0-1638168881400.png


Best Regards,
Community Support Team_ Yalan Wu
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

2 REPLIES 2
v-yalanwu-msft
Community Support
Community Support

Hi, @Hamdan1234 ;

You could create a another table then create a measure .

1.create a table as slicer, and don't create a relationship.

slicer = SUMMARIZE('Table',[Date],"year-month",FORMAT([Date],"mmmm yyyy"))

2.create a measure.

CumProduction =
CALCULATE (
    SUM ( 'Table'[Production] ),
    FILTER (
        ALLEXCEPT ( 'Table', 'Table'[Location] ),
        [Months Producing] <= MAX ( 'Table'[Months Producing] )
    )
)

The final output is shown below:

vyalanwumsft_0-1638168881400.png


Best Regards,
Community Support Team_ Yalan Wu
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

amitchandak
Super User
Super User

@Hamdan1234 , You can use closingbalancemonth or lastnonblank(values('Date'[Date]), [meausre])

 

refer

https://www.youtube.com/watch?v=yPQ9UV37LOU

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin
Want To Learn Power BI
Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
Proud to be a Super User!

Helpful resources

Announcements
Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Jan 2022 Dev Camp 768x460 copy.png

Power BI Dev Camp- January 27th, 2022

Mark your calendars and join us for our next Power BI Dev Camp!

Top Solution Authors
Top Kudoed Authors