Forum Discussion

mmalhame's avatar
mmalhame
Cloud Apps
08-20-2024
Solved

Create a % Contribution Over Time Calculation

I am trying to create a stacked bar chart view that shows the % of each category, for each date, over time. 

However, when I try to use the contribution function, the % values returned are calculated for the entire period, not per date.

For example, for the month of 04/2023 the number of "No" users was 171 and the number of "Not Decided Yet" users was 272. I want the chart to show 39% for "No" and 61% for "Not Decided Yet". Instead, the chart shows 10% for "No" and 8% for "Not Decided Yet".  

The formula being used is simply: contribution(COUNT([case_id]))

Is there any way to get the view I want?

 

  • hey mmalhame ,

    the contribution function provide the Contribution for the Date Column while the need is to show the Contribution, i.e. percentages out of total, for each category for the same period. 

    A quick solution which can provide this is to modify the widget formula.
    the new formula: COUNT([case_id]) / (COUNT([case_id]),all(Dimension_name))

    Formula Explanation:

    • All function - ignore the scope of the Dimension.
    • the dimension is the column name which return the value of "No" and "Not Decided Yet"

    See example - using simple Count [# of OrderQty]

    Using the formula include ALL Function: [# of OrderQty]/ ([# of OrderQty],all([Region]))
    the Contribution display for each chart

    Best Regards

4 Replies

  • AssafHanina's avatar
    AssafHanina
    Sisense Employee

    hey mmalhame ,

    the contribution function provide the Contribution for the Date Column while the need is to show the Contribution, i.e. percentages out of total, for each category for the same period. 

    A quick solution which can provide this is to modify the widget formula.
    the new formula: COUNT([case_id]) / (COUNT([case_id]),all(Dimension_name))

    Formula Explanation:

    • All function - ignore the scope of the Dimension.
    • the dimension is the column name which return the value of "No" and "Not Decided Yet"

    See example - using simple Count [# of OrderQty]

    Using the formula include ALL Function: [# of OrderQty]/ ([# of OrderQty],all([Region]))
    the Contribution display for each chart

    Best Regards

  • Hello mmalhame.

    Welcome to the Sisense Community! 

    Thank you for reaching out. Hopefully another Community member is able to help you, but if you don't get an answer in the next day or two I will reach out internally to get you an answer.

    Have a great day!