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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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!:
Mastering Power BI 2nd Edition

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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