Category Archives: Dax Code Patterns

Ranking Donors. Breaking Tie.

I recently run into an issue when I needed to select the top 5 donors based on the contribution amount by occupation. The process is not that complex, however, for certain occupations, a large number of donors had the same … Continue reading

Posted in Dax Code Patterns | Tagged , , , , | Comments Off on Ranking Donors. Breaking Tie.

First Month Gifts Using Generate Function

Often we need to derive first-month sales/donations. In the sample dashboard that I built using public FEC data, there are donors with multiple donations. The formula below allows determining donations in the first month since the first donation in a … Continue reading

Posted in Dax Code Patterns | Tagged , , , , | Comments Off on First Month Gifts Using Generate Function

Donors With Multiple Gifts

Often we need to derive donor with multiple gifts grouped by other dimensions. In the example below, I am adding a count of donors in a specified range from a zip code who made multiple donations. The dashboard example is … Continue reading

Posted in Dax Code Patterns | Tagged , , , | Comments Off on Donors With Multiple Gifts

Adding Contribution Range Visual

It is often useful too add a gift bracket and then pivot and visualize those ranges. In the example below, I am adding a gift range and then visualizing what kind of gifts (small – large) generated most of the … Continue reading

Posted in Dax Code Patterns | Tagged , , , | Comments Off on Adding Contribution Range Visual

Using CrossFilter To Alter Relationship

I recently came over an example of CROSSFILTER function in DAX. While not very common I can see a lot of potential in certain circumstances. Essentially, in a measure, it temporarily alters relationships. In most cases, there is a fact … Continue reading

Posted in Dax Code Patterns | Tagged , , , | Comments Off on Using CrossFilter To Alter Relationship

DAX Retention Year Over Year Pattern

Often we need to write many lines of code in SQL to derive retention year over year. Generally, we join the main fact table to itself and then add a condition that a donor this year has to also be … Continue reading

Posted in Dax Code Patterns | Tagged , , , | Comments Off on DAX Retention Year Over Year Pattern