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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
SarahESkells
Helper I
Helper I

MTD and YTD table

Hello

 

I think this is a straightforward question but I am struggling to get the data to work for me.

 

I have a table of data, I have changed the layout to work for me so looks something like the below:

QTD query.JPG

The data comes from a spreadsheet where the individual is required to input a value for each month, I want to create a table like the below but am struggling to get the measures to work as just get the error "Time intelligence quick measures can only be grouped or filtered by the Power BI-provided date hierarchy or primary date column." 

WhoMTDQTDYTD
Person 13001,2674,967
Person 2101503,720

 

Any help will be appreciated

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

Hi @SarahESkells ,

According to your description, if you use the DATESMTDDATESQTD,  DATESYTD functions in the MTD, QTD, YTD measures, it can't return correct result because these functions refer to a date column which doesn't exsit in your visual. Here's my solution, create three measures.

MTD =
CALCULATE (
    SUM ( 'Table'[Value] ),
    FILTER ( 'Table', EOMONTH ( 'Table'[Date], 0 ) = EOMONTH ( TODAY (), 0 ) )
)
QTD =
CALCULATE (
    SUM ( 'Table'[Value] ),
    FILTER (
        'Table',
        YEAR ( 'Table'[Date] ) = YEAR ( TODAY () )
            && QUARTER ( 'Table'[Date] ) = QUARTER ( TODAY () )
    )
)
YTD =
CALCULATE (
    SUM ( 'Table'[Value] ),
    FILTER ( 'Table', YEAR ( 'Table'[Date] ) = YEAR ( TODAY () ) )
)

Get the correct result.

vkalyjmsft_0-1660791041948.png

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

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

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

Create a Calendar Table with calculated column formulas for Year, Month name and Month number.  Sort the Month name by the Month number.  Create a relationship (Many to One and Single) from the Date column of the Data Table to the Date column of the Calendar Table.  Create slicers for Year and Month name and select 1 year and month

Write these measures

MTD = sum(Data[Amount])

YTD = calculate([MTD],datesytd(calendar[Date],"31/12")

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-yanjiang-msft
Community Support
Community Support

Hi @SarahESkells ,

According to your description, if you use the DATESMTDDATESQTD,  DATESYTD functions in the MTD, QTD, YTD measures, it can't return correct result because these functions refer to a date column which doesn't exsit in your visual. Here's my solution, create three measures.

MTD =
CALCULATE (
    SUM ( 'Table'[Value] ),
    FILTER ( 'Table', EOMONTH ( 'Table'[Date], 0 ) = EOMONTH ( TODAY (), 0 ) )
)
QTD =
CALCULATE (
    SUM ( 'Table'[Value] ),
    FILTER (
        'Table',
        YEAR ( 'Table'[Date] ) = YEAR ( TODAY () )
            && QUARTER ( 'Table'[Date] ) = QUARTER ( TODAY () )
    )
)
YTD =
CALCULATE (
    SUM ( 'Table'[Value] ),
    FILTER ( 'Table', YEAR ( 'Table'[Date] ) = YEAR ( TODAY () ) )
)

Get the correct result.

vkalyjmsft_0-1660791041948.png

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

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

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! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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