Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi Community! I know I'm in the right place to get some help...
I have a table of donors that is connected to a table of pledges, and this one is also connected to a table of gifts. These donors donate monthly.
The relationships are 1 to many in the same order described. One donor can have one or more pledges (commitments of donations) and a pledge has one or more gifts (their donations really made). Pledges have two states: Active (if they are currently donating) or Inactive.
It happens that some donors cancel their pledges and after some time, the NGO will try to recover him or her. When they are succesfull, this is what we call a "reactivation". We want firstly to know how many were reactivated. Secondly, it would be great (desirable) to know which donor or which pledges were reactivated.
How should we count them? Well... I need to translate in DAX the following logic and look for those
Does it sound complicated? What approach would you suggest?
Best,
Gerónimo
Solved! Go to Solution.
Hi @gtutusaus,
Based on the sample in this thread. I try to reproduce and post the following solutions.
First, my logic is filter all the donors whose status are active, and filter all the donors whose status are inactive in separate tables(Active and Inactive tables). Then get the minimum date for donors, and remove the duplicates in inactives.
Create two table by clicking "New Tables" under modeling on home page based on the requirement above.
Active = SELECTCOLUMNS(FILTER(Pledges2,Pledges2[PLEDGE STATUS]="Activo"),"HonorId",Pledges2[DONOR ID],"Date",Pledges2[DATE PLEDGE ACTIVATION])
Inactive = DISTINCT(SELECTCOLUMNS(FILTER(Pledges2,Pledges2[PLEDGE STATUS]="Inactivo"),"HonorId",MIN(Pledges2[DONOR ID]),"Date",Pledges2[DATE PLEDGE ACTIVATION]))
Second, create relationship between the two new tables.
Third, create a calculated column using the formula.
flag = IF( ISBLANK(RELATED(Inactive[Date])),BLANK(),IF(RELATED(Inactive[Date])<Active[Date],"Yes","NO"))
Finally, create a measure to calculate reactivations, and create a card visual to display it.
reactive = COUNTROWS(DISTINCT(FILTER(Active,Active[falg]<>BLANK()&&Active[falg]="Yes")))
Best Regards,
Angelia
Perhaps you could add a calculated to donors with the following formula:
=
VAR table1 =
CALCULATETABLE ( 'Pledges', 'Pledges'[PLEDGE STATUS] = "Inactivo" )
VAR table2 =
CALCULATETABLE ( VALUES ( 'Pledges'[DATE PLEDGE ACTIVATION] ) )
RETURN
COUNTAX (
table1,
COUNTROWS (
FILTER (
table2,
'Pledges'[DATE PLEDGE ACTIVATION]
> EARLIER ( 'Pledges'[DATE PLEDGE ACTIVATION] )
)
)
)
Wow! Didn't know about variables... I added only one filter to table 1 so I skip pledges that were never activated (blank activation dates).
It seems to be working great but how do I propagate it to the pledge level? For example, I would like to know when these reactivations happened by their activation dates.
Many many thanks!
Gerónimo
Hi @gtutusaus,
Based on the sample in this thread. I try to reproduce and post the following solutions.
First, my logic is filter all the donors whose status are active, and filter all the donors whose status are inactive in separate tables(Active and Inactive tables). Then get the minimum date for donors, and remove the duplicates in inactives.
Create two table by clicking "New Tables" under modeling on home page based on the requirement above.
Active = SELECTCOLUMNS(FILTER(Pledges2,Pledges2[PLEDGE STATUS]="Activo"),"HonorId",Pledges2[DONOR ID],"Date",Pledges2[DATE PLEDGE ACTIVATION])
Inactive = DISTINCT(SELECTCOLUMNS(FILTER(Pledges2,Pledges2[PLEDGE STATUS]="Inactivo"),"HonorId",MIN(Pledges2[DONOR ID]),"Date",Pledges2[DATE PLEDGE ACTIVATION]))
Second, create relationship between the two new tables.
Third, create a calculated column using the formula.
flag = IF( ISBLANK(RELATED(Inactive[Date])),BLANK(),IF(RELATED(Inactive[Date])<Active[Date],"Yes","NO"))
Finally, create a measure to calculate reactivations, and create a card visual to display it.
reactive = COUNTROWS(DISTINCT(FILTER(Active,Active[falg]<>BLANK()&&Active[falg]="Yes")))
Best Regards,
Angelia
Wow, Angelia! Many many thanks! Let me ask you one more thing... can I create also in Power Pivot the same kind of tables?
Best,
Gerónimo
Hi @gtutusaus,
Yeah, you can also create calculated column and measure in Power Pivot. You can post Power Pivot issue on Power Pivot forum. If my reply is helpful, please mark it as answer.
Thanks,
angelia
Sorry, my DAX knowledge is quite limited.
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
87 | |
76 | |
74 | |
55 | |
45 |
User | Count |
---|---|
117 | |
106 | |
77 | |
66 | |
65 |