Forum Discussion

Youri98's avatar
Youri98
Helper I
1 year ago
Solved

DAX - cumulative % small difference. Rounding?

Hi! I've got a simple DAX showing the % per month. Dividing the new products / total per month. The % for each month is correct. Now, I would like to show a line in my chart, showing the cumulative ...
  • bhanu_gautam's avatar
    1 year ago

    Youri98 The discrepancy you're seeing in the cumulative percentage values is likely due to the way cumulative percentages are calculated and possibly due to rounding differences

    Calculate the cumulative total of new products:

    DAX
    CumulativeNewProducts =
    CALCULATE(
    SUM('Table'[New per month]),
    FILTER(
    ALLSELECTED('Table'),
    'Table'[Month] <= MAX('Table'[Month])
    )
    )

     

    Calculate the cumulative total of all products:

    DAX
    CumulativeTotalProducts =
    CALCULATE(
    SUM('Table'[Total per month]),
    FILTER(
    ALLSELECTED('Table'),
    'Table'[Month] <= MAX('Table'[Month])
    )
    )

     

    Calculate the cumulative percentage:

    DAX
    CumulativePercentage =
    DIVIDE(
    [CumulativeNewProducts],
    [CumulativeTotalProducts],
    0
    )