Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
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?
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...
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
User | Count |
---|---|
139 | |
113 | |
103 | |
73 | |
63 |
User | Count |
---|---|
135 | |
126 | |
110 | |
70 | |
61 |