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
claytonduvall
New Member

DATESYTD or TOTALYTD excluding filtered dates

Is there a way to use the DATESYTD or TOTALYTD DAX expression and allow it to exclude the dates that have been filtered by the user?     I tried both of these expressions, to display a YTD total for a KPISum measure.

 

YTD-KPISum:= CALCULATE (
'Daily KPI'[KPISum],
DATESYTD ( 'Date'[DayDate] )
)

 

YTD-KPISum:= TOTALYTD('Daily KPI'[KPISum],'Date'[DayDate])

 

It works fine when all of the dates are included and even with any other filters applied.  However, when I add any filter on the dates, (ex. Business Day only), it doesn't exclude those dates from the YTD totals.

 

See the example below.  Notice when I add a Business Day filter, the YTD-KPISum on 1/23/17 is 2 over.  In this case it is not filtering out the 2 on 1/22/17.  Is there a way I can get the YTD Sum to not include the dates that have been filtered?

 

Capture.JPG

3 REPLIES 3
Greg_Deckler
Super User
Super User

See if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Thanks for the quick reply, Greg.    I don't quite follow your solution, here though.  In my case I do have a date field and it has the proper relationships set up.   The YTD function works fine in most cases.  It is just when the user wants to filter out certain dates like weekends where I can't get the YTD functions to work.  I can't quite figure out how to get these date expressions for YTD to exclude dates that are filtered out.   Any suggestions?

Hi @claytonduvall ,

Could you please offer a sample file to have a test if possible?

 

Regards,

Daniel He

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

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.