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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

Getting date value of current chosen month till previous months

Hello Everyone!!

I am stuck at a dax problem.
I have two tables i.e Date table and File closure table( this table is having file closure month that is having a relationship with date table month). now i am using month name from date table into my slicer and want to count the number of row in file closure table from chosen month till the start of the year.

E.g. say i chosed march from slicer than the number of rows i want to count from file cosure table should be from january till march.

I cannot chose multiple months to add previous  month data due to my schema limitations.

Kindly help me out in resolving this issue. 

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , In this case DatesYTD or TotalYTD should help. Make sure the Date table is marked as a date table

 

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
This year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR('Date'[Date]),"12/31"))
Last year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))

 

Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a

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
wdx223_Daniel
Super User
Super User

CALCULATE(COUNTROWS(FileTable),DATESYTD(Dates[Date]))

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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