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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
jdoehrman
Frequent Visitor

Cumulative Total data points with no data (0s) display as the maximum issue

I am trying to develop a Ticket Sales cumulative line graph sectioned out by how many weeks before the event the tickets were bought.

 

I used the following DAX command to get the cumulative total.

jdoehrman_0-1704989475598.png

 

And here is the graph that results from this measure.

jdoehrman_1-1704989537398.png

 

The issue that appears is the data points of 0 display as the maximum, or what is known as the final total at 0 Weeks Out from the event. What is even more confusing is that the cumulative total measure recognizes those data points as 0s because let's say the final total is 100; those 0s show up as 100 but the measure does not count them because it knows they are 0s.

 

This problem is even more apparent when I insert a legend.

jdoehrman_2-1704989810376.png

All of these spikes are weeks where no tickets were sold, and instead of maintaining the past week's total, they spike to the maximum (final total) and are not included in the measure's calculation.

 

I have also considered excluding these data points that spike, since they would be 0 anyway, but there are over 1500 that would need to be excluded and after 50, PowerBI gives me an error.

 

Is there anything I can include in my DAX command to make these "spikes" smooth out and carry over the past week's total?

1 ACCEPTED SOLUTION
v-tangjie-msft
Community Support
Community Support

Hi @jdoehrman ,

 

According to your description, here are my steps you can follow as a solution.

(1) This is my test data. 

vtangjiemsft_0-1705477113469.png

(2) We can create a measure. 

Better RT = 
    VAR __Date = MAX('Table'[Bought_Weeks_Out])
    VAR __Table = FILTER(ALLSELECTED('Table'),[legend]=MAX('Table'[legend]) && [Bought_Weeks_Out] >= __Date)
RETURN
    SUMX(__Table,COUNT('Table'[ticket_id]))

(3) Then the result is as follows.

vtangjiemsft_1-1705477149918.png

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

View solution in original post

3 REPLIES 3
v-tangjie-msft
Community Support
Community Support

Hi @jdoehrman ,

 

According to your description, here are my steps you can follow as a solution.

(1) This is my test data. 

vtangjiemsft_0-1705477113469.png

(2) We can create a measure. 

Better RT = 
    VAR __Date = MAX('Table'[Bought_Weeks_Out])
    VAR __Table = FILTER(ALLSELECTED('Table'),[legend]=MAX('Table'[legend]) && [Bought_Weeks_Out] >= __Date)
RETURN
    SUMX(__Table,COUNT('Table'[ticket_id]))

(3) Then the result is as follows.

vtangjiemsft_1-1705477149918.png

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

Greg_Deckler
Super User
Super User

@jdoehrman Looks like a single table data model and in that case CALCULATE will cause you trouble. Use a No CALCULATE approach: Better Running Total - Microsoft Fabric Community

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler Thank you for the reply, the video was great.

 

The cumulative total overall is fixed,

jdoehrman_0-1704998502537.png

 

However Week 0 is showing a total of 18171.

jdoehrman_1-1704993487584.png

But when I add in my legend, it seems to be combining all of them in their weird way and inflating the totals. This problem is solved when I single-in on just one of these but the goal is to have them all on the graph.

 

Edit: I am also noticing the issue of when a legend group doesnt sell a ticket within "0 weeks out" their line will stop at the last week they sold. Is there a way to always include a final number on week 0?

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

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