The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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:
What I need:
Solved! Go to Solution.
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])
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.
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.
How can I apply this for multiple items. I have data with different amounts but I only need the last day of the month that was updated but I also have multiple offices in my dataset. So I need to filter by the last day of the month by office.
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 ( thisdate, 0 )
RETURN
IF ( thisdate = lastDOM, [Total Sales] )
Pat
To learn more about Power BI, follow me on Twitter or subscribe 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.
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])
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.
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.
You are the best, that's exactly what I needed! Thanks and have a great day!
Greetings from Brazil!
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
105 | |
77 | |
74 | |
44 | |
36 |
User | Count |
---|---|
152 | |
110 | |
64 | |
64 | |
57 |