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
- 6 Blackbaud Community Help
- 209 bbcon®
- 1.4K Blackbaud Altru®
- 395 Blackbaud Award Management™ and Blackbaud Stewardship Management™
- 1.1K Blackbaud CRM™ and Blackbaud Internet Solutions™
- 15 donorCentrics®
- 360 Blackbaud eTapestry®
- 2.5K Blackbaud Financial Edge NXT®
- 648 Blackbaud Grantmaking™
- 567 Blackbaud Education Management Solutions for Higher Education
- 3.2K Blackbaud Education Management Solutions for K-12 Schools
- 937 Blackbaud Luminate Online® and Blackbaud TeamRaiser®
- 84 JustGiving® from Blackbaud®
- 6.5K Blackbaud Raiser's Edge NXT®
- 3.7K SKY Developer
- 247 ResearchPoint™
- 118 Blackbaud Tuition Management™
- 165 Organizational Best Practices
- 239 The Tap (Just for Fun)
- 33 Blackbaud Community Challenges
- 31 PowerUp Challenges
- 3 (Open) PowerUp Challenge: Data Health
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Product Update Briefing
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Standard Reports+
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Email Marketing
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Gift Management
- 4 (Closed) Raiser's Edge NXT PowerUp Challenge: Event Management
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Home Page
- 4 (Closed) Raiser's Edge NXT PowerUp Challenge: Standard Reports
- 4 (Closed) Raiser's Edge NXT PowerUp Challenge: Query
- 782 Community News
- 2.9K Jobs Board
- 53 Blackbaud SKY® Reporting Announcements
- 47 Blackbaud CRM Higher Ed Product Advisory Group (HE PAG)
- 19 Blackbaud CRM Product Advisory Group (BBCRM PAG)
