cancel
Showing results for 
Search instead for 
Did you mean: 

Create a % Contribution Over Time Calculation

mmalhame
7 - Data Storage
7 - Data Storage

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?

mmalhame_0-1724165090268.png

 

1 ACCEPTED SOLUTION

AssafHanina
Sisense Team Member
Sisense Team Member

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]

AssafHanina_0-1724193006816.png

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

AssafHanina_1-1724193186816.png

Best Regards

Assaf

View solution in original post

4 REPLIES 4

DRay
Community Team Member
Community Team Member

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!

David Raynor (DRay)

AssafHanina
Sisense Team Member
Sisense Team Member

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]

AssafHanina_0-1724193006816.png

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

AssafHanina_1-1724193186816.png

Best Regards

Assaf

DRay
Community Team Member
Community Team Member

Thank you @AssafHanina@mmalhame, did that work for you?

David Raynor (DRay)

mmalhame
7 - Data Storage
7 - Data Storage

Yes this worked for me, thank you so much!