Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi
I have a table with SalesAmount and SalesDate and want to be able to see the YTD total. Our year runs from 1st May-30April.
This is the code I have but I keep getting syntax incorrect.
Solved! Go to Solution.
For the time intelligence functions to work correctly you need a proper date table, marked as a date table. Link the 'Date'[Date] column to your vw_PBI_Dashboard_Bills[CreatedDate] column and then the measure becomes simply
YTD Billing =
CALCULATE (
SUM ( vw_PBI_Dashboard_Bills[BilledAmount] ),
DATESYTD ( 'Date'[Date], "4/30" )
)
Thanks for your response, I appreciate your input. I can get it working with a different calendar table which is limited to just the dates in our year but not the full date table which has 20 years of dates (I could probably reduce this).
I have a date table created from an article but it's not working when I use
DATESYTD ( 'Date'[Date], "4/30" )
rather than the Created date. I've linked the table and tried linking both ways but got blank results - any ideas?
Thanks
There needs to be some element from the date table in the visual. If there isn't, try adding a filter so that the date is in this day.
For the time intelligence functions to work correctly you need a proper date table, marked as a date table. Link the 'Date'[Date] column to your vw_PBI_Dashboard_Bills[CreatedDate] column and then the measure becomes simply
YTD Billing =
CALCULATE (
SUM ( vw_PBI_Dashboard_Bills[BilledAmount] ),
DATESYTD ( 'Date'[Date], "4/30" )
)
Thanks, @johnt75
This seems to work, rather than linking the date table, any reason why I shouldn't do it this way?
That might work but it is considered best practice to have a proper date table. As well as guaranteeing that the time intelligence functions work as expected you can break the data down by month, week etc and you can add other useful columns such as is the day a working day or not. There's lots of articles and videos on creating a date table.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
19 | |
14 | |
13 | |
11 | |
8 |