Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
CLS479
Frequent Visitor

Using a date slicer to determine the age of a record

Hello,

 

I am trying to use a date slicer (not related to my main data table) to calculate the age of a record. Here is what my outcome shows in Excel and I would like to duplicate it in PowerBI. I can get the  Pivot to replicate in PBI, however the dispersion table needs to be able to give me the count of date ages AS OF the date that I select with a slicer.  I've been looking through threads all day and cannot find exactly what I need. Any help is appreciated.

 

CLS479_0-1702671044203.png

 

7 REPLIES 7
Anonymous
Not applicable

Hi  @CLS479 ,

I created some data:

Age Table:

vyangliumsft_0-1702968972241.png

Date Table:

vyangliumsft_1-1702968972242.png

Here are the steps you can follow:

1. Create calculated column.

Year Month =
FORMAT(
    'Date'[Date],"mmm") &"-"&FORMAT('Date'[Date],"yy")
Max_date =
MAXX(
    FILTER(ALL('Date'),
    'Date'[Year Month]=EARLIER('Date'[Year Month])),[Date])

vyangliumsft_2-1702968989293.png

2. Create calculated table.

Using the Date table's [Year Month] as a Column will sort alphabetically by default, so create a new table and sort by date.

Table =
SUMMARIZE('Date','Date'[Year Month],'Date'[Max_date])

vyangliumsft_3-1702968989294.png

3. Joining a relationship between two tables.

vyangliumsft_4-1702969158767.png

4. Select [Year Month] – Column tools – Sort by column – [Max_date]

vyangliumsft_5-1702969158770.png

5. Create measure.

Count =
COUNTX(
    FILTER('Date',
    'Date'[Year Month]=MAX('Date'[Year Month])),[LoctionID])

vyangliumsft_6-1702969176354.png

Test =
var _maxdate=
MAXX(
    FILTER(ALL('Date'),'Date'[Year Month]=MAX('Date'[Year Month])),[Date])
return
IF(
   MAX('Date'[Max_date])<=DATE(2023,1,30),[Count],BLANK())

6. Result:

 

vyangliumsft_7-1702969176357.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Thank you for your response, however this solution is not exactly what I am looking for. 

Ashish_Mathur
Super User
Super User

Hi,

I am not sure of how you generated the Dispersion table.  Share the download link of the PBI file with the formulas already written in the dispersion table.


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

The dispersion table was manually created in Excel. Each month, the totals in the dispersion table are manually added. I am trying to re-create it in PowerBI by using a date filter to get a snapshot of what the dispersion numbers would be with an AS OF view. So if I wanted to see the totals AS OF January 30, 2023, it would show those totals and so on.

Hi,

I can help further only when you share what i requested in my earlier message.


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

Hi @CLS479 ,

Please see attached pbix you can reference. The concept is very similar as your use case if not the same.

 

danextian_0-1702700820798.png

 

 

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Hello @danextian 

 

Thank you for your response. This is almost exactly what I was looking for. The only difference is that I am looking at the age in months not years. How could I change the tables/measures to count the age in months instead?

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors