Forum Discussion
Replacing Blanks with 0 - Adding +0/ creating a new measure not working!
- 7 years ago
Thanks Anonymous - that clears things up perfectly.
The simplest way to explain this is that you need related tables to make the measure work how you want, as using values from the same table as the rows and columns in the matrix doesn't quite produce the results you expect.
By using fields from two related tables, Power BI will produce the product of these two fields and resolve the measure correctly.
The only change i made to your model was to add a simple Date table, and link the date column of your example table to it, e.g.:
Separate Date table - notice that I've marked the Date column in your example table as hidden, as this links the tables and shouldn't be used in the visual
Now in the model, I'll swap out the matrix to use the column from this table - now your matrix works using your existing measure e.g.:
I've uploaded a copy of your doc with the change I've made - hopefully this will work so you can download and review.
Date tables are an essential modelling technique for Power BI - here's a good post on the subject for you to review.
It's also adisable to split your model into facts and dimensions if possible. The same team have a good series on this:
- What is a Relationship?
- What is the Cardinality of the Relationship?
- What is the Direction of the Relationship?
- Data preparation; First and Foremost Important task
- What is a Dimension table and why say No to a single big table
- Basics of Modelling in Power BI: Fact Tables
Hope this all helps,
Daniel
Thanks Anonymous - that clears things up perfectly.
The simplest way to explain this is that you need related tables to make the measure work how you want, as using values from the same table as the rows and columns in the matrix doesn't quite produce the results you expect.
By using fields from two related tables, Power BI will produce the product of these two fields and resolve the measure correctly.
The only change i made to your model was to add a simple Date table, and link the date column of your example table to it, e.g.:
Separate Date table - notice that I've marked the Date column in your example table as hidden, as this links the tables and shouldn't be used in the visual
Now in the model, I'll swap out the matrix to use the column from this table - now your matrix works using your existing measure e.g.:
I've uploaded a copy of your doc with the change I've made - hopefully this will work so you can download and review.
Date tables are an essential modelling technique for Power BI - here's a good post on the subject for you to review.
It's also adisable to split your model into facts and dimensions if possible. The same team have a good series on this:
- What is a Relationship?
- What is the Cardinality of the Relationship?
- What is the Direction of the Relationship?
- Data preparation; First and Foremost Important task
- What is a Dimension table and why say No to a single big table
- Basics of Modelling in Power BI: Fact Tables
Hope this all helps,
Daniel
- Anonymous7 years agoNot applicable
Hi dm-p ,
Thank you for your solution! It worked perfectly.
Also, thanks for the links to resources.