Forum Discussion
Measure to show zero data where no data for date
Hi,
We are struggling with DAX, to create a measure that puts zeros for blank values.
Data:
Date Time Tokens User
| 09/11/2020 00:00:01 | 10 | Harry |
| 09/11/2020 01:00:01 | 10 | Harry |
| 09/11/2020 02:00:01 | 10 | Harry |
| 09/11/2020 03:00:01 | 10 | Harry |
| 09/11/2020 04:00:01 | 10 | Harry |
| 09/11/2020 05:00:01 | 10 | Harry |
| 09/11/2020 06:00:01 | 10 | Harry |
| 09/11/2020 07:00:01 | 10 | Harry |
| 09/11/2020 08:00:01 | 10 | Harry |
| 09/11/2020 09:00:01 | 10 | Harry |
| 09/11/2020 09:00:01 | 10 | Sally |
| 09/11/2020 10:00:01 | 10 | Harry |
| 09/11/2020 10:00:01 | 10 | Sally |
| 09/11/2020 11:00:01 | 10 | Harry |
| 09/11/2020 11:00:01 | 10 | Sally |
| 09/11/2020 11:00:01 | 20 | Bob |
| 09/11/2020 12:00:01 | 10 | Harry |
| 09/11/2020 12:00:01 | 10 | Sally |
| 09/11/2020 12:00:01 | 20 | Bob |
| 09/11/2020 13:00:01 | 10 | Harry |
| 09/11/2020 13:00:01 | 10 | Sally |
| 09/11/2020 14:00:01 | 10 | Harry |
| 09/11/2020 14:00:01 | 10 | Sally |
| 09/11/2020 15:00:01 | 10 | Harry |
| 09/11/2020 16:00:01 | 10 | Harry |
| 09/11/2020 17:00:01 | 10 | Harry |
| 09/11/2020 18:00:01 | 10 | Harry |
| 09/11/2020 19:00:01 | 10 | Harry |
| 09/11/2020 20:00:01 | 10 | Harry |
| 09/11/2020 21:00:01 | 10 | Harry |
| 09/11/2020 22:00:01 | 10 | Harry |
| 09/11/2020 23:00:01 | 10 | Harry |
| 10/11/2020 00:00:01 | 10 | Harry |
Visual initially looks good,
but when we filter by user.
Line should go to zero at 18:00 on 09/11/2020.
We think a measure should resolve this.
We've tried various ideas i.e.
But have not succeded in the correct expression.
Happy to share pbix. if it makes it clearer.
Many thanks in advance.
Cgull this is a large problem than what looks on the surface, as a best practice, you always want to have dimension in your model and strive for star schema and that's is the root cause of this problem. Understand star schema and the importance for Power BI - Power BI | Microsoft Docs
See attached and now you want to tweak the measure as referred to in the previous reply for the SQLBI video.
✨ Follow us on LinkedIn
Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to 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.⚡
5 Replies
- parry2kSuper User
Cgull this is a large problem than what looks on the surface, as a best practice, you always want to have dimension in your model and strive for star schema and that's is the root cause of this problem. Understand star schema and the importance for Power BI - Power BI | Microsoft Docs
See attached and now you want to tweak the measure as referred to in the previous reply for the SQLBI video.
✨ Follow us on LinkedIn
Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to 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.⚡
- parry2kSuper User
Cgull one quick way is to add +0 to the measure, and also check this post that explains it very well. How to return 0 instead of BLANK in DAX - SQLBI
✨ Follow us on LinkedIn
Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to 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.⚡
- CgullFrequent Visitor
Hi parry2k
Hopefully this works?
Link to pbx file
Best wishes