Quantcast
Channel: Desktop topics
Viewing all articles
Browse latest Browse all 216047

Help optimizing DAX with SUMX and RELATEDTABLE

$
0
0

Hi everyone,

 

Here is the challenge.  I have a table of donors, and a related table of mailings to those donors.  I need to calculate the first-year cost of those mailings, on a per-donor basis (the cost of the mailings to each donor in the first year after each donor is added to the file).

 

I have some code that works, but I'm getting out of memory errors when I load in a few hundred million rows of data.  Is there a more efficient way to perform this calculation?

 

This is the calculated column:

_______________

Year1 Cost=
CALCULATE (
      SUMX (
          RELATEDTABLE ( Mailing ),
                 Mailing[Cost]
        ),
FILTER (
            RELATEDTABLE ( Mailing ),
             Mailing[MailDate]<= Donor[AddDate] + 365
    )
)

_______________

By the  way, I also have to calculate Year 2 and Year 3 costs, so the memory issue is compounded.

 

Thanks for any suggestions!

Dan


Viewing all articles
Browse latest Browse all 216047

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>