Forum Discussion

tnrahim's avatar
tnrahim
Frequent Visitor
7 years ago
Solved

Creating a Cumulative Histogram

Hi Everyone,

 

I was wondering if anyone could help me create the following visualization

 

Y axis  = number of tickets

X axis = Age of tickets Days

 

Specifically I need help either creating the calculated columns highlighted in yellow or measures that would do the same thing. I've been working with Calculation, Count, and related functions but I can't seem to nail down the right combination of the three.

 

 

 

EDIT - Pasting Data

 

Table 1  Table 2  
Ticket IDAge (days) Age DaysCount of tickets with Age (days) >Age Days%
a23 125100%
b5 224100%
c12 323100%
d12 422100%
e2 52080%
f7 61976%
g18 71768%
h3 81664%
i14 91560%
j4 101456%
k5 111352%
l6 12936%
m12 13832%
n7 14728%
o21 15416%
p15 16416%
q8 17416%
r9 18312%
s10 19312%
t15 20312%
u21 2114%
v15 2214%
x12 2300%
y11 2400%
z13 2500%
   
   10000%
  • Anonymous's avatar
    Anonymous
    7 years ago

    Ok to achieve this we need an AGE table, which simply has a column called "Age(Days)" with a unique values from 1 to the number of days you want in the graph.  Link this to Table1 in your table relationships.

     

    Create this measure:

    Cumulative Measure = VAR currentAge = max(Age[Age (Days)])
    RETURN
    CALCULATE(
        COUNTROWS(Table1),
        ALL(Table1),
        Table1[Age (days)] > currentAge
    )


    Create a line graph using these settings:
    Axis - 'Age'[Age(Days)]
    Values - The measure we created
    You'll get this:

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Ok to achieve this we need an AGE table, which simply has a column called "Age(Days)" with a unique values from 1 to the number of days you want in the graph.  Link this to Table1 in your table relationships.

     

    Create this measure:

    Cumulative Measure = VAR currentAge = max(Age[Age (Days)])
    RETURN
    CALCULATE(
        COUNTROWS(Table1),
        ALL(Table1),
        Table1[Age (days)] > currentAge
    )


    Create a line graph using these settings:
    Axis - 'Age'[Age(Days)]
    Values - The measure we created
    You'll get this:

    • tnrahim's avatar
      tnrahim
      Frequent Visitor

      That's great! Thank you for your help :)

       

      Follow up question

       

      How would I add a bar to show the target days? When I tried the bar was horizontal instead of vertical.

       

      I updated the proposed function to allow for outside filters.

       

      Cumulative Measure = VAR currentAge = max(Age[Age (Days)])
      RETURN
      CALCULATE(
          COUNTROWS(Table1),
          ALLSELECTED(Table1),
          Table1[Age (days)] > currentAge
      )

       

      This is what I would like it to look like.

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        Great suggestion on your alteration to the code.  Its great to see you getting your head around the code and tweaking it to your scenario.

         

        I can't think of an easy way to create the line you want.  Most of the trending are all hoziontal lines.  Its possible to use the "Line and Clustered Column chart" to have vertical lines, so my thoughts are to using that some how.