The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hello Everyone,
My Financial Year (FY) runs from December to November.
Now I am trying to create a YTD measure for sales as follows:
Sales Date Max = CALCULATE(MAX('Sales'[InvoiceDate]), All ('Sales'))
@Anonymous , With help from date table and time intelligence
YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"11/30"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"11/30"))
Power BI December to November Financial Year Calendar: https://community.powerbi.com/t5/Quick-Measures-Gallery/Power-BI-December-to-November-Financial-Year-Calendar/m-p/1574446#M657
Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uA
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.
Hi @amitchandak
Thanks for looking into it and sharing the solution.
When I tried it, the first part worked, i.e. 'YTD Sales' measure worked but I am facing an issue with 'Last YTD Sales' measure. I am using my 'Invoice Date' column for dates that has duplicate date values and I think for that is creating an issue.
Error msg -> "[Last YTD Sales]: Function 'DATEADD' expects a contiguous selection when the date column is not unique, has gaps or it contains time portion."
Is there a workaround where I can still use the 'Invoice Date' field to get the desired output?
Thanks for your help.
Animesh
@Anonymous , use date table, marked as date, else you will get some error or other
I discussed these issues in details here - https://www.youtube.com/watch?v=OBf0rjpp5Hw
User | Count |
---|---|
17 | |
8 | |
7 | |
6 | |
6 |
User | Count |
---|---|
26 | |
13 | |
12 | |
9 | |
8 |