cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
uie07923
Frequent Visitor

Show only latest day of each month - Visual

Hi guys,

 

I have a database with inventory values for each day. I don't necessarily have the data for all days.

I need to make a visual that shows only the latest date of each month.

 

As of now, users have to manually filter the last days available for each month.

As it is:

power bi 1.png

 

What I need:

pbi2.png

 

1 ACCEPTED SOLUTION
RicoZhou
Community Support
Community Support

Hi @uie07923 

You can build a filter measure to achieve your goal.

I build a sample to have a test. YearMonth column is a calculated column.

YearMonth = YEAR(Sheet4[Date])*100+MONTH(Sheet4[Date])

1.png

Measure:

Filter = 
VAR _MaxDate =
    MAXX (
        FILTER ( ALL ( Sheet4 ), Sheet4[YearMonth] = MAX ( Sheet4[YearMonth] ) ),
        Sheet4[Date]
    )
RETURN
    IF ( MAX ( Sheet4[Date] ) = _MaxDate, 1, 0 )

Add this measure into visual level filter field and set it to show items when the value is 1. Result is as below.

1.png

Best Regards,

Rico Zhou

 

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

4 REPLIES 4
mahoneypat
Super User
Super User

Assuming you always have inventory values for the last DOM (vs. last working DOM), you can use a measure expression like this (also assuming you have a separate Date table, but you can use the same approach if not).

 

Last DOM =
VAR thisdate =
    MAX ( 'Date'[Date] )
VAR lastDOM =
    EOMONTH ( thisdate0 )
RETURN
    IF ( thisdate = lastDOM, [Total Sales] )

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Hi there! Thanks for the quick reply.

I don't always have the last DOM. It can be that the last working day of the month was not the last day per se.

RicoZhou
Community Support
Community Support

Hi @uie07923 

You can build a filter measure to achieve your goal.

I build a sample to have a test. YearMonth column is a calculated column.

YearMonth = YEAR(Sheet4[Date])*100+MONTH(Sheet4[Date])

1.png

Measure:

Filter = 
VAR _MaxDate =
    MAXX (
        FILTER ( ALL ( Sheet4 ), Sheet4[YearMonth] = MAX ( Sheet4[YearMonth] ) ),
        Sheet4[Date]
    )
RETURN
    IF ( MAX ( Sheet4[Date] ) = _MaxDate, 1, 0 )

Add this measure into visual level filter field and set it to show items when the value is 1. Result is as below.

1.png

Best Regards,

Rico Zhou

 

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

You are the best, that's exactly what I needed! Thanks and have a great day!

Greetings from Brazil!

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

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