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

line graph

hi

i was trying to compare last year nd current year calls

but im not getting the correct month count

i was using the below dax

 

YTD lidlit = CALCULATE(COUNT(Request[Escalated to Lidl IT]),DATESYTD('Calendar'[Date]))
last ytd it = CALCULATE(COUNT(Request[Escalated to Lidl IT]),DATESYTD(dateadd('Calendar'[Date],-1,YEAR)))
greeshma_0-1613730608991.png

 


 
 

 

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , At least one measure seems correct. Make sure the Calendar table is marked as the Date table.

 

In case you do not need YTD only month data

MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))

last year MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-12,MONTH)))

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous ,

 

Please try this:

YTD =
CALCULATE (
    COUNT ( 'Table'[Escalated to Lidl IT] ),
    DATESYTD ( 'Table'[Date] )
)
Last YTD = VAR DataMaxDate =
    CALCULATE ( MAX ( 'Table'[Date] ), ALL ('Table' ) )
RETURN
    CALCULATE (
        [YTD],
        SAMEPERIODLASTYEAR (
            INTERSECT (
                VALUES ( 'Table'[Date] ),
                DATESBETWEEN ( 'Table'[Date], BLANK (), DataMaxDate )
            )
        )
    )

 

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

 

amitchandak
Super User
Super User

@Anonymous , At least one measure seems correct. Make sure the Calendar table is marked as the Date table.

 

In case you do not need YTD only month data

MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))

last year MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-12,MONTH)))

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.