Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hey, is there a function or a reliable way to get the type (like number, duration, currency, ...) of each metadata column in the dataview? I can see that the underlyingType and primitiveType is changing but I don't know if this is the desired way to get the type.
Regards
Lucas
Hi @lucmax,
In terms of structure, the type property is a ValueTypeDescriptor, of which only the properties text thru none are included in the interface spec. This means that the underlyingType thru categoryString properties are presumably added by the developer visual (which the API implements). As such their implementation details aren't in the source code and it's going to be hard to figure out what those mean, or rely on them consistently.
You can see that there are some overlaps also, such as numeric and integer.
In my experience, if I have a dependency on the column type, I'll typically switch on them while iterating through and manage my logic that way (e.g. dates vs. numbers for axes) when building my view model.
If you are able, it might be worth providing some details of your particular use case, as we might be able to find a way to achieve what you are ultimately setting out to do.
Regards,
Daniel
Proud to be a Super User!
My course: Introduction to Developing Power BI Visuals
On how to ask a technical question, if you really want an answer (courtesy of SQLBI)
Hi @dm-p,
thanks for the answers, I will try to provide more details of what we want to achive.
The problem with the ValueTypeDescriptor for me is, that is does not directly provide information about currency data. Also, if I provide a column with a duration type (in the powerbi data model) it does not have type.duration set to true.
In the visual the user can apply custom labels for a graph which we transform and display in a user friendly way (duration: 5d 10h 24m, or currency: 524,56€). For this transformation we need to know the type of the datafield in the power bi data model.
We need to group the types into plain text, standard numeric values, duration and currency values.
regards,
Lucas
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
13 | |
2 | |
2 | |
1 | |
1 |
User | Count |
---|---|
20 | |
3 | |
2 | |
2 | |
2 |