Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
I have a report, where I currently have 3 cards showing today's value (distinct count) of three different categories.
I'll like to change the setup, so instead of showing today's values, the cards must show the value from the max date of the date slicer - and also return a blank value if no rows are found on that date.
I tried multiple calculations proposals from this community and others, but I haven't found a solution so far.
The closest I have is the following:
Test =
VAR MaxDate =
CALCULATE( MAX( 'data'[date] ), ALLEXCEPT( 'data', 'data'[date] ))
VAR Numbers =
CALCULATE( DISTINCTCOUNT( 'data'[someId] ), FILTER( 'data', 'data'[date] = MaxDate ))
RETURN
Numbers
But it returns the count from the latest date for each category, not for the max date of the slicer. It's easy to test by returning "MaxDate" instead of "Numbers".
If I use "ALL" instead of "ALLEXCEPT", the max date of the data set is returned, but then the date slicer is ignored.
All data is in one table, and I don't have calendar/date table.
Any ideas?
BR Morten
Hi @Anonymous,
Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.
If these also don't help, please share more detailed information to help us clarify your scenario to test.
How to Get Your Question Answered Quickly
Regards,
Xiaoxin Sheng
Hi,
Here is one way to get the maxdate:
without selection:
You don't necessarily need the ALLSELECTED in the dax so it can be removed for same result.
You mentioned that you don't have calendar but I recommend creating one and marking it as a date table, since it is useful for many scenarios and without one your model will create local date tables.
Proud to be a Super User!
Hi Valtteri,
Thank you for your answer!
So I need to add a calendar table to the model or how did you set it up? And is the calendar table connected to the other table in the data model?
/Morten
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
22 | |
7 | |
6 | |
6 | |
6 |
User | Count |
---|---|
27 | |
12 | |
10 | |
9 | |
6 |