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
Anonymous
Not applicable

YTD DAX

Hi everyone, 

I'm making a Dax measure to calculate a YTD, my measure is : 

 YTD = TOTALYTD([Monthly TNQ],'Calendar'[Date])
So according to this measure, my results are right, but the data are existing from 1/1/2019 to 1/9/2019 so in my bar chart the data are shown until 1/12/2019. 
 
So I would like to change this measure in order to have the real results from 1/1/2019 to 1/9/2019.
 
Thank you.
Best regards.
2 ACCEPTED SOLUTIONS

Can you try like

YTD = 
var _max = max(table[date])
TOTALYTD([Monthly TNQ],'Calendar'[Date],'Calendar'[Date]<=_max)

View solution in original post

Hi @Anonymous 

 

Try something like 

 

Sales YTD = 
IF( 
    NOT ISEMPTY( Sales ), 
    CALCULATE(
        [Sales],
        DATESYTD( 'Calendar'[Date] )
    )
)
Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

 

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi @Anonymous 

 

Try something like 

 

Sales YTD = 
IF( 
    NOT ISEMPTY( Sales ), 
    CALCULATE(
        [Sales],
        DATESYTD( 'Calendar'[Date] )
    )
)
Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

 

Anonymous
Not applicable

Hi @Mariusz 

It does work and this is the results comparing Y vs Y-1 : 

45321.PNG

 

How can I get the results like is shown in this graph : 

 

sdfsdfz.PNG

Thank you !

Best regards. 

Anonymous
Not applicable

Can you try like

YTD = 
var _max = max(table[date])
TOTALYTD([Monthly TNQ],'Calendar'[Date],'Calendar'[Date]<=_max)
Anonymous
Not applicable

this is the results on my bar chart graph : 

6323.PNG

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.