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
CookieMonster
Helper I
Helper I

Stacked Area Chart with Cumulative Cost - Straight line when no values

Hi,

I have the following Stacked Area Chart

CookieMonster_0-1630588311899.png

What I am trying to work out, is how I can make it do a straight line across, when no further data exists for that legend item, or if data is missing for that legend item on a particular date.

This is the measure I currently have to work out the cumulative cost:

 

CumulativeCost = 
CALCULATE (
    SUM ( 'Usage details'[costInBillingCurrency] ),
    FILTER (
        ALL ( 'Usage details'[date] ),
        'Usage details'[date] <= MAX ( 'Usage details'[date] )
    )
)

 

I hope my question makes sense and someone can help.

 

5 REPLIES 5
parry2k
Super User
Super User

@CookieMonster why do you expect it to start at 0 if there is data on August 01st?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super User

@CookieMonster change this too

 

CumulativeCost = 
CALCULATE (
    SUM ( 'Usage details'[costInBillingCurrency] ),
    FILTER (
        ALL ( 'Date'[Date] ),
        'Date'[Date] <= MAX ( 'Date'[Date] )
    )
)

 

if you read my post, one step is to mark this table as a calendar table, and seems like you missed that.

 

Follow us on LinkedIn

 

Check my latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Yes I did sorry,

I have changed it to a Date Table now, but now the lines on the graph do not start at £0.

CookieMonster_0-1630653796548.png

 

Is this being caused by the DAX formular do you think?

parry2k
Super User
Super User

@CookieMonster you should add a calendar dimension in your model, you can following my blog post here to add one. Create a basic Date table in your data model for Time Intelligence calculations | PeryTUS IT Solutio...

 

Once that table is added, change your measure to use date from this new calendar table and also on x-axis use date from this new table and that will do it.

 

Follow us on LinkedIn

 

Check my latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

I have just tried this and it has left me with this:

CookieMonster_0-1630595057548.png

 

So it no longer looks to be cumculative, any ideas where I went wrong?

My measure is now: 

CumulativeCost = 
CALCULATE (
    SUM ( 'Usage details'[costInBillingCurrency] ),
    FILTER (
        ALL ( 'Date'[Date].[Date] ),
        'Date'[Date].[Date] <= MAX ( 'Date'[Date] )
    )
)

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.