Forum Discussion

Abz_17's avatar
Abz_17
Icon for Helper I rankHelper I
1 year ago
Solved

Data Aggregation Issue

Need some help please. I have a Power BI report which has been produced using an Excel data source, for which I have created a frequency metric (calculated donations/donors). There are also a few sli...
  • Power2G's avatar
    1 year ago

    This issue occurs because your DAX measure might not be correctly handling the slicer selections and is summing up instead of averaging based on the unique donor count. Try doing somehing like this.

    Frequency = 
    VAR UniqueDonors = DISTINCTCOUNT( Donations[DonorID] ) 
    RETURN 
    DIVIDE( SUM( Donations[Amount] ), UniqueDonors, 0 )

    If your frequency metric is in a table that is affected by slicers, wrap the calculation in CALCULATE to ensure it respects slicer selections.

    Frequency = 
    VAR UniqueDonors = CALCULATE( DISTINCTCOUNT( Donations[DonorID] ), ALLSELECTED(Donations[Ethnicity]) )
    RETURN 
    DIVIDE( SUM( Donations[Amount] ), UniqueDonors, 0 )

    This will ensure that when multiple are selected, the correct unique donor count is used rather than incorrectly summing across selections.

     

    Let me know if this helps!