Solved! Go to Solution.
Datesytd, totalytd can give you YTD. But you need to make sure input is a date.
In case you want filter year =2018. then you can use DATE[DATE].YEAR =2018 in filter.
Year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date]))
Year Sales = CALCULATE(SUM(Sales[Sales Amount]),'Date'[Date].year=2018))
Also prefer to a calendar, most date calculation work best with calendar.
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks.
My Recent Blog - https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601
@ruliana for time intelligence calculations it is advised to have date calendar in your model and run all calculations from there. There are many posts to achieve this. For now, you can remove .year from your formula and see if it works.
Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Thanks,
I'll work on adding a date table, but for now I removed the .[YEAR] and got this error
Error Message:
MdxScript(Model) (9, 132) Calculation error in measure 'WEEKLY Tbl_MV_TM_VENDOR_PURCHASE'[2018 Baseline (QTY)]: A date column containing duplicate dates was specified in the call to function 'DATESYTD'. This is not supported.
Is there another date/year function that would work better than DATESYTD?
Datesytd, totalytd can give you YTD. But you need to make sure input is a date.
In case you want filter year =2018. then you can use DATE[DATE].YEAR =2018 in filter.
Year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date]))
Year Sales = CALCULATE(SUM(Sales[Sales Amount]),'Date'[Date].year=2018))
Also prefer to a calendar, most date calculation work best with calendar.
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks.
My Recent Blog - https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601
Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.
Put your data visualization and design skills to the test! This exciting challenge is happening now through May 31st!
User | Count |
---|---|
339 | |
96 | |
61 | |
49 | |
47 |
User | Count |
---|---|
323 | |
118 | |
81 | |
68 | |
63 |