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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Cumulative line chart break

Hello,

I'm trying to make a cumulative chart with this code:

YTD GP = CALCULATE(
    SUM(BIPER[GP]),
    FILTER(
        ALLSELECTED(BIPER),
        BIPER[Invoice Date] <= MAX(BIPER[Invoice Date])
    )
)
 
and the result shown like this:image.png

 

The line for YTD GP breaks when there is no data for that day. I set X-axis type to 'Categorical' because when I set to 'Continuous', the chart looks more weird and unreadable.

 

Is there any other way that I can fix this in Format or DAX?

 

Thank you.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Actually I already has date dimension. The reason I use the current table's date is because I designed the goal for every working day at my company. So if I use the date dimension, the line for Goal will break. 

I already find the solution and it works. So here's my new measure:

 

YTD GP = 
IF(MAX('CALENDAR'[Date])>TODAY(), BLANK(), 
    IF(MAX(ST[Date])=BLANK(), BLANK(),
        CALCULATE(
            SUM(BIPER[GP]),
            FILTER(
                ALLSELECTED('CALENDAR'),
                'CALENDAR'[Date] <= MAX('CALENDAR'[Date])
            )
        )
    )
)

 

Anyway, thank you @parry2k !

View solution in original post

4 REPLIES 4
parry2k
Super User
Super User

@Anonymous add +0 to your measure

 

try this
 
Same Business Day Sales PY = 
VAR __currentBusinessDay = MAX ( Calendar[BusinessDay] )
RETURN
CALCULATE (
SUM ( Table[Sales] ),
DATEADD ( Calendar[Date], -1, YEAR ),
Calendar[BusinessDay] = __currentBusinessDay
) + 0


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.

Anonymous
Not applicable

It gets worseimage.png

 

@Anonymous i didn't notice that you are not using date dimension. It is recommended to add date dimension and use that for this calculation instead of using date from your transaction table. there are many posts on how to add date dimension in the model.



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.

Anonymous
Not applicable

Actually I already has date dimension. The reason I use the current table's date is because I designed the goal for every working day at my company. So if I use the date dimension, the line for Goal will break. 

I already find the solution and it works. So here's my new measure:

 

YTD GP = 
IF(MAX('CALENDAR'[Date])>TODAY(), BLANK(), 
    IF(MAX(ST[Date])=BLANK(), BLANK(),
        CALCULATE(
            SUM(BIPER[GP]),
            FILTER(
                ALLSELECTED('CALENDAR'),
                'CALENDAR'[Date] <= MAX('CALENDAR'[Date])
            )
        )
    )
)

 

Anyway, thank you @parry2k !

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.