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
Anonymous
Not applicable

Cumulative line (Whale Curve)

Hi,


I'm trying to make a cumulative line based on sales to each customer.

Currently I have sales and customers in a graph but the amount does not add up (blue line). How to make it like shown(in red) in the picture?

2222.png
Thanks in advance

1 ACCEPTED SOLUTION
Anonymous
Not applicable

14 REPLIES 14
Baskar
Resident Rockstar
Resident Rockstar

Try this 

Var _date = max(date column)

Measure=

    calculate(sum(sales),keepfilters( All(date column) <= _date) )

 

 

replace your date column 

Anonymous
Not applicable

Hi Baskar,

 

Doesn't seem to work:

1. OmzWhale = 
VAR var_Date = max(Dates[Date])
Measure = CALCULATE(SUM(TB[Amount]),KEEPFILTERS(ALL(Dates[Date]) <= var_Date))

This gives error: The syntax for Measure is incorrect.

1. OmzWhale = 
VAR var_Date = max(Dates[Date])
Return CALCULATE(SUM(TB[Amount]),KEEPFILTERS(ALL(Dates[Date]) <= var_Date))

This gives "The true/false expression does not specify a column."

Hi @Anonymous,

 

please try

 

OmzWhale = 
VAR var_Date = max(Dates[Date])
Measure = CALCULATE(SUM(TB[Amount]),FILTER(ALL('Dates'),Dates[Date]) <= var_Date))

Hope this Helps,
Richard


Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up! 



I hope this helps,
Richard

Did I answer your question? Mark my post as a solution! Kudos Appreciated!

Proud to be a Super User!


Anonymous
Not applicable

Hi, still gives me an error on the "Measure =" part.
Fyi it does not recognize the last part where you use var_Date

hi @Anonymous,

 

sorry,

missed the return and made a pasting error,

 

OmzWhale = 
VAR var_Date = max(Dates[Date])
return
CALCULATE(SUM(TB[Amount]),FILTER(ALL('Dates'),Dates[Date]) <= var_Date))

 



I hope this helps,
Richard

Did I answer your question? Mark my post as a solution! Kudos Appreciated!

Proud to be a Super User!


Anonymous
Not applicable

This returns the following error:
A function "FILTER" has been used in a true/false expression that is used as a table filter expression. This is not allowed.

Thanks for your help so far @richbenmintz 

Anonymous
Not applicable

It works if I use:

 

 

1. OmzWhale = 
VAR var_Date = max(Dates[Date])
Return CALCULATE(SUM(TB[Amount]),Dates[Date] <= var_Date))

 

 


But the line does not look different.
The X axis in the graph is not date related FYI it's all the customers sorted by biggest amount to lowest. 


Hi @JVDS ,

 

Again some bracketing issues


 

This works, yes, but same as above. The graph line does not change.

Hi @Anonymous,

 

please provide sample data and expected output.

 

Thanks,



I hope this helps,
Richard

Did I answer your question? Mark my post as a solution! Kudos Appreciated!

Proud to be a Super User!


Anonymous
Not applicable

Hi,

Ok the table where we are getting things from is a transaction table, with every line being a transaction.

We are using the filtered amount, not normal amount 
Amount Filtered (Amount = 0 if not class 2 in other table)

Expected result is shown in the picture..

AmountCustomerDateAmount Filtered Class
1001Cus101-01-201001Class 2
200Cus220-01-20200Class 2
500Cus313-03-200Class 1
300Cus213-03-200Class 3
200Cus115-02-20200Class 2

 

 

The solution you provided me works on date, I don't need it to work on date. I need it to work on customers

So from highest to lowest amount the line should go:

Customer 1 + customer 2,
Customer 1 and 2 + customer 3,
Customer 1, 2 and 3 + customer 4,
etc

JVDS_0-1597327371875.png

This, but the X axis is NOT dates but CUSTOMERS

Hi @Anonymous ,

 

Please try the following Measures as i think they provide what you are asking for

 

 

OmzWhaleRank = 
    var ranker = RANKX(all('TB'), [Amount Filtered ], SUM(TB[Amount Filtered ]), desc, Skip)
return
    ranker

OmzWhale = 
    var ranker = RANKX(all('TB'), [Amount Filtered ], SUM(TB[Amount Filtered ]), desc, Skip)
    //create the cummulative sum of the Customers from minnow to Whale
    var cum_val = CALCULATE(sum(TB[Amount Filtered ]), FILTER(all('TB'), ranker <= [OmzWhaleRank]))
return
    cum_val

 

 

richbenmintz_0-1597343742070.png

Hope this Helps,
Richard


Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!



I hope this helps,
Richard

Did I answer your question? Mark my post as a solution! Kudos Appreciated!

Proud to be a Super User!


Anonymous
Not applicable

Hey Richard,

 

Almost there I think 🙂

It just needs to have 1 fix.

Right now it cumulates from lowest cost to highest. But I want it to start with the highest and then add all the others to that.
light blue line is what I have now with your latest measure:

JVDS_0-1597396361015.png

This is the result I'm looking for:

JVDS_1-1597396472236.png

 

Hi @Anonymous,

 

All you had to do was change the sort order of the ranking function.

 

Hope this Helps,
Richard


Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!



I hope this helps,
Richard

Did I answer your question? Mark my post as a solution! Kudos Appreciated!

Proud to be a Super User!


Anonymous
Not applicable

Ended up using:
https://www.youtube.com/watch?v=rlUBO5qoKow
And got it working

Hi @Anonymous ,

 

Again some bracketing issues

 

OmzWhale = 
VAR var_Date = max(Dates[Date])
return
CALCULATE(SUM(TB[Amount]),FILTER(ALL('Dates'),Dates[Date] <= var_Date))

 



I hope this helps,
Richard

Did I answer your question? Mark my post as a solution! Kudos Appreciated!

Proud to be a Super User!


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.