Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi All,
I have data tables like below:
All customer data including birthday and many other traits
ID | Birthday | other columns... |
111 | 1/1/1995 | |
222 | 2/2/2000 | |
333 | 3/3/1890 | |
... | ... |
Historical customer list table showing the historical date and any ID that was an active customer on that date
ID | Upload Date |
111 | 1/1/2020 |
222 | 1/1/2020 |
111 | 1/2/2020 |
222 | 1/2/2020 |
333 | 1/2/2020 |
... | ... till today |
Calendar table with all dates from 1/1/2020 to today.
Relationships:
Calendar table is linked to historical table by upload date.
All customer data table is linked to historical table by ID.
Is there a way to show average age of our active customers by year? Thank you!
Solved! Go to Solution.
Hi @alya1
I made up some random data and was wondering if these measures would help.
Age =
IF(
MAX( 'Customer'[BirthDate] ),
SELECTEDVALUE( 'Date'[Year] ) - YEAR( MAX( 'Customer'[BirthDate] ) )
)
Avg Age =
AVERAGEX(
ALLSELECTED( 'Historical'[ID] ),
[Age]
)
Let me know if you have any questions.
Hi @alya1
I made up some random data and was wondering if these measures would help.
Age =
IF(
MAX( 'Customer'[BirthDate] ),
SELECTEDVALUE( 'Date'[Year] ) - YEAR( MAX( 'Customer'[BirthDate] ) )
)
Avg Age =
AVERAGEX(
ALLSELECTED( 'Historical'[ID] ),
[Age]
)
Let me know if you have any questions.
Hi gmsamborn, thank you very much for your reply!
I tried following along with your DAX but sadly it didn't work. I think it's because my Calendar table only have dates "from 1/1/2020 to today." So every customers age for year 2021 is 18 and 2022 is 19 and so on. Do you have any other ideas?
Hi @alya1
Is the realtionship between Historical and Customer set to both directions?
If that isn't the problem, can you please supply a pbix file with data that covers your problem as well as expected results from THAT data.
I think that was it! Thank you so much 😄
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
145 | |
85 | |
66 | |
52 | |
48 |
User | Count |
---|---|
215 | |
90 | |
83 | |
67 | |
59 |