Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
tnrahim
Frequent Visitor

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.

 

 

Capture.PNG

 

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%
1 ACCEPTED SOLUTION
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.
Capture.PNG

 

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:
Capture2.PNG

View solution in original post

3 REPLIES 3
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.
Capture.PNG

 

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:
Capture2.PNG

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.

Capture.PNG

 

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. 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.