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
jonno83
Regular Visitor

Problems charting cumulative counts

Hi folks

 

I am struggling in my presentation of a cumulative count using a stacked area chart and would appreciate any help you can provide.

 

I have a measure which is calculating the desired output correctly (well at least until I chart it):

 

CumulativeClients = VAR __LAST_DATE = LASTDATE(ClientsDateKey[Date].[Date]) RETURN IF (__LAST_DATE > DATE(YEAR(TODAY()),MONTH(TODAY()),1)-1, BLANK(), CALCULATE(COUNT(Clients[EnvironmentClientLocation]),Filter(ALLSELECTED(ClientsDateKey),ClientsDateKey[Date] <= max(ClientsDateKey[Date]))))

 

When charted, as far as I can tell, a point is plotted only when the cumulative count changes. If there is no change from one month to the next, no point is plotted. When using a stacked chart, this gives some very odd results, see the screenshot below for a good example.

 

Does anyone know of a way to get around this issue?

 

Many thanks

Jon

2020-04-01 22_42_18-Stacked area chart.png

2 REPLIES 2
amitchandak
Super User
Super User

You can get cumulative like

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(('Date'[Date]),"12/31")) // yearly

Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(date,date[date] <=maxx(date,date[date]))) //Over all

 

Use a date table.

Sort seems to be an issue. Create month year sort column and mark it as the sort column

Month year sort = Format([Date],"YYYYMM")

 

Sort_by_column.pngSortnewribbion.png

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

Hi @amitchandak. Thanks for your response. I've already got a date table in my data model and refer to it in this case, as I said, I'm happy with the calculations and the numbers produced by my cumulative count.

 

I've followed your steps but this has resolved my charting issue. Generally I was expecting any resolution to this to be on the charting side, or else a manipulation of the calculation (I had thought about updating the measure to add a tiny amount like 0.000001 for each step, but hoped there was a purer approach).

 

Thanks again

Jon

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.