Power Bi: dax formula
I need to create a Dax formula to count the donors who gave in 2024 but not in 2023 and not 2022. Can you help me?

Comments
-
@Veronica Krivis
using chatgpt.. modify your prompt a bit:I need to create a Dax formula to count the donors who gave a gift in 2024 but not in 2023 and not 2022. assume a table of individual gift with columns: Frid, Year, Paid_v where Frid is individual donor id Year is year of gift Paid_v is amount given
Response:
You can create a DAX formula that counts donors who gave a gift in 2024 but not in 2023 or 2022 by using a combination of CALCULATE, FILTER, EXCEPT, and DISTINCT. Here's how you can structure the formula:
Donors_2024_Not_2023_2022 =
VAR Donors2024 =
CALCULATETABLE(
DISTINCT(IndividualGift[Frid]),
IndividualGift[Year] = 2024,
IndividualGift[Paid_v] > 0
)
VAR Donors2023 =
CALCULATETABLE(
DISTINCT(IndividualGift[Frid]),
IndividualGift[Year] = 2023,
IndividualGift[Paid_v] > 0
)
VAR Donors2022 =
CALCULATETABLE(
DISTINCT(IndividualGift[Frid]),
IndividualGift[Year] = 2022,
IndividualGift[Paid_v] > 0
)
RETURN
COUNTROWS(
EXCEPT(
Donors2024,
UNION(Donors2023, Donors2022)
)
)Explanation:
- Donors2024: This variable retrieves a distinct list of donors (Frid) who gave a gift in 2024.
- Donors2023: This variable retrieves a distinct list of donors who gave a gift in 2023.
- Donors2022: This variable retrieves a distinct list of donors who gave a gift in 2022.
- EXCEPT: This function is used to exclude donors from 2024 who also gave in 2023 or 2022.
- COUNTROWS: Finally, the formula counts the number of rows, representing the number of unique donors who donated in 2024 but not in 2023 or 2022.
This formula will give you the count of donors who donated only in 2024 and not in the previous two years.
in Power BI DAX, there is always more than one way to do a measure, try this one and see how you like it
2 -
@Alex Wong
Thank you!! Have a nice day!!1
Categories
- All Categories
- 2 Blackbaud Community Help
- High Education Program Advisory Group (HE PAG)
- BBCRM PAG Discussions
- Luminate CRM DC Users Group
- DC Luminate CRM Users Group
- Luminate PAG
- 186 bbcon®
- 1.4K Blackbaud Altru®
- 389 Blackbaud Award Management™ and Blackbaud Stewardship Management™
- 1K Blackbaud CRM™ and Blackbaud Internet Solutions™
- 14 donorCentrics®
- 355 Blackbaud eTapestry®
- 2.4K Blackbaud Financial Edge NXT®
- 616 Blackbaud Grantmaking™
- 542 Blackbaud Education Management Solutions for Higher Education
- 3.1K Blackbaud Education Management Solutions for K-12 Schools
- 909 Blackbaud Luminate Online® and Blackbaud TeamRaiser®
- 207 JustGiving® from Blackbaud®
- 6.2K Blackbaud Raiser's Edge NXT®
- 3.5K SKY Developer
- 236 ResearchPoint™
- 116 Blackbaud Tuition Management™
- 160 Organizational Best Practices
- 232 The Tap (Just for Fun)
- 30 Blackbaud Community Challenges
- Blackbaud Consultant’s Community
- 18 PowerUp Challenges
- 3 Raiser's Edge NXT PowerUp Challenge: Gift Management
- 4 Raiser's Edge NXT PowerUp Challenge: Events
- 3 Raiser's Edge NXT PowerUp Challenge: Home Page
- 4 Raiser's Edge NXT PowerUp Challenge: Standard Reports
- 4 Raiser's Edge NXT PowerUp Challenge #1 (Query)
- 71 Blackbaud Community All-Stars Discussions
- 47 Blackbaud CRM Higher Ed Product Advisory Group (HE PAG)
- 743 Community News
- 2.8K Jobs Board
- Community Help Blogs
- 52 Blackbaud SKY® Reporting Announcements
- Blackbaud Consultant’s Community
- 19 Blackbaud CRM Product Advisory Group (BBCRM PAG)
- Blackbaud Francophone Group
- Blackbaud Community™ Discussions
- Blackbaud Francophone Group