Forum Discussion
Leading zeros getting lost in dataflow
- 3 years ago
Somewhere these values are being changed to numbers and the leading zeros are dropping. They must be forced to be strings in the dataflow itself. If you let it detect the datatype when storing, it will use a numerical type.
Somewhere these values are being changed to numbers and the leading zeros are dropping. They must be forced to be strings in the dataflow itself. If you let it detect the datatype when storing, it will use a numerical type.
- brunoctesser3 years agoHelper I
Thanks for the answer. I understand that, but besides defining the data type as text in the dataflow (which I already did) what other steps are possible?
- edhans3 years agoCommunity Champion
You will need to show me the M code for the query. If it isn't working, then something else is going on in the code. The dataflow isn't changing the datatypes without being told to.
- brunoctesser3 years agoHelper I
It seems to have worked when I explicitly set the data type to text in the query, even though it came originally as text from the data source before. Now I am able to define this as the one-side of a relationship. It's doesn't make much sense and maybe I am missing something, but it worked.
However, let's say I need to refer to this dimension table to get the list price for an item and multiply it by the quantity sold that resides in a fact table. I would use something like this:
Measure = f_fact[Quantity Sold] * RELATED(d_Item[List Price])
I am not being able to do this. Power BI returns the error "The column 'd_Item[List Price]' either doesn't exist or doesn't have a relationship to any table available in the current context."
The column does exist and the tables have a valid relationship. Also, I looked it up and RELATED is supported by Direct Query. The relationship seems to work when building visualizations in the report (d_Item filters f_fact), but somehow when running the DAX query the relationship is invalid.
I really don't know what's going on.