Forum Discussion
Calculating accurate sales data
- Anonymous6 years ago
Anonymous
1. For the YTD you could try this following formula, if you only need Year 2020, you can add another year filter to the dax.YTD measure = CALCULATE(SUM('Table'[Sales]),DATESYTD('Table'[Date]))2. To get "-" when no selected you could create a measure. For example, this measure uses Isfiltered() to determine whether the company is filtered.
Measure = IF(ISFILTERED('Table'[Company]),[YTD measure],"-")
Paul Zheng _ Community Support Team
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous you should HASONEFILTER function and check if a value is selected or not and based on that tweak your measure to return VALUE or '--'
As a best practice, add date dimension in your model and use it for and time intelligence calculations. Once the date dimension is added, mark it as a date table on table tools.
https://perytus.com/2020/05/22/create-a-basic-date-table-in-your-data-model-for-time-intelligence-calculations/
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.⚡