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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
bdurham15
Frequent Visitor

Line Chart displays wrong dates with TTM measure

Hello,

 

I have a standard line chart with a trendline that displays almost all of my measures, except for any "TTM" Measures that I have. Non date bound measures work ok, as well as measures that I am using TOTALMTD((QTD),(YTD)) with. Even though I have a consecutive series of months selected in a slicer above, when using the TTM measures, all months in the calendar are displayed.  I have been using the chart in published reports for weeks now, but recently updated my calendar table to run completely in query editor, so that I have to make little to no changes in calculated columns. When comparing to my old dataset, I can't seem to find what may be different or what is causing this problem. Also note that in this same report page I have the measures working properly in a table.
image.png

image.png

 

image.png

TTM Total Sales = 
CALCULATE (
    [Total Sales],
    DATESBETWEEN (
        'Calendar'[Date],
        NEXTDAY ( SAMEPERIODLASTYEAR ( LASTDATE ( 'Calendar'[Date] ) ) ),
        LASTDATE ( 'Calendar'[Date] )
    )
)

 

1 ACCEPTED SOLUTION

After doing some more digging Mr. Ferrari at SQLBI was able to help out. Adding this bolded and italicized portion to the forumla did away with the unwanted dates, and is also the most efficient way to make the calculation (compared to an IF statement that would excluded the dates not selected).

@v-yulgu-msft thank you for your help regardless!

TTM Total Sales = 
DIVIDE( [Total Sales], [Total Sales] ) * 
CALCULATE (
    [Total Sales],
    DATESBETWEEN (
        'Calendar'[Date],
        NEXTDAY ( SAMEPERIODLASTYEAR ( LASTDATE ( 'Calendar'[Date] ) ) ),
        LASTDATE ( 'Calendar'[Date] )
    )
)

 

 

View solution in original post

3 REPLIES 3
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @bdurham15,

 

Please set the X-axis type to Categorical for a test.

1.PNG

 

regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-yulgu-msft, thank you for your response, unfortunately this does not correct the issue.

image.png

After doing some more digging Mr. Ferrari at SQLBI was able to help out. Adding this bolded and italicized portion to the forumla did away with the unwanted dates, and is also the most efficient way to make the calculation (compared to an IF statement that would excluded the dates not selected).

@v-yulgu-msft thank you for your help regardless!

TTM Total Sales = 
DIVIDE( [Total Sales], [Total Sales] ) * 
CALCULATE (
    [Total Sales],
    DATESBETWEEN (
        'Calendar'[Date],
        NEXTDAY ( SAMEPERIODLASTYEAR ( LASTDATE ( 'Calendar'[Date] ) ) ),
        LASTDATE ( 'Calendar'[Date] )
    )
)

 

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.

Top Solution Authors